![](/img/trans.png)
[英]I want to find unique duplicates value in array,but i am not getting below is my code in java
[英]i want to connect to SQL Server using Java, please find the code below and i am getting the exception as given below “Error Message”
String dburl="jdbc:sqlserver://209.18.103.198:1433;CreditDB_V2";
//Connecting to Database
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
Connection con=java.sql.DriverManager.getConnection(dburl,"700User","cred!tUser");
Thread.sleep(20000);
if (con!=null)
{
System.out.println("Database Connected Successfully");
Statement stmt=con.createStatement();
ResultSet rss=stmt.executeQuery("update User_LogDetail set LoginTime=(GETDATE()-
35), StatusId = 401 where UserId in(select userid from user_detail where UserName
in('sahooxml','gopal','psahoo7'))");
Thread.sleep(30000);
while (rss.next()) {
Object dbtime = rss.getString(1);
System.out.println(dbtime);
} //end while
con.close();
}
else
{
System.out.println("Database Failed to connect");
}
錯誤信息:
Exception in thread "main" java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Login700.LoginTest(Login700.java:26)
at Login700.main(Login700.java:242)
包含“ com.microsoft.sqlserver.jdbc.SQLServerDriver”類的jar文件必須位於您的類路徑中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.