简体   繁体   English

java.sql.SQLException:找不到适用于jdbc:microsoft的驱动程序

[英]java.sql.SQLException: No suitable driver found for jdbc:microsoft

Hello i need to connect my java program to a Microsoft Sql server. 您好,我需要将Java程序连接到Microsoft Sql服务器。 I get java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://LB236:1521;databasename=checkpointDB I cant not find any problems pleas look at my code and tell me whats wrong. 我得到java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://LB236:1521;databasename=checkpointDB我找不到任何问题,请看一下我的代码并告诉我怎么了。

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+ properties.getProperty(CP.dbHost.toString())+":"+properties.getProperty(CP.dbPort.toString())+";databasename="+properties.getProperty(CP.dbDatabase.toString()),properties.getProperty(CP.dbUser.toString()),AppDecrypter.getInstance().decrypt(properties.getProperty(CP.dbPassword.toString())));

Full Stack Trace: 全栈跟踪:

java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://LB236:1521;databasename=checkpointDB
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at de.mvn.gotdb_mvn.Importer.openConnection(Importer.java:117)
at de.mvn.gotdb_mvn.Importer.openConnection(Importer.java:135)
at de.mvn.gotdb_mvn.Main.main(Main.java:33)

I think the problem is with the JDBC url you have put. 我认为问题出在您输入的JDBC网址上。

It should be jdbc:sqlserver://ServerName\\sqlexpress..... 它应该是jdbc:sqlserver:// ServerName \\ sqlexpress .....

Make sure that the sqljdbc jar file which you are using is included in the build path of your project. 确保您正在使用的sqljdbc jar文件包含在项目的构建路径中。

Here is a good tutorial for sql server 这是 SQL Server 的好教程

The connection url should be like this: 连接网址应如下所示:

DriverManager.getConnection("jdbc:sqlserver://"+.......

Omit the ":microsoft" from the connection string. 忽略连接字符串中的“:microsoft”。

Hope this works. 希望这行得通。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.sql.SQLException:没有找到适合 jdbc:microsoft:sqlserver 的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver java.sql.SQLException:找不到适合jdbc:oracle:thin的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:oracle:thin java.sql.SQLException:找不到适用于jdbc:derby的驱动程序: - java.sql.SQLException: No suitable driver found for jdbc:derby: java.sql.SQLException:找不到适用于jdbc:mysql的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:mysql java.sql.SQLException:找不到适用于jdbc:sqlserver的驱动程序: - java.sql.SQLException: No suitable driver found for jdbc:sqlserver: java.sql.SQLException:找不到适用于jdbc:sqlserver://的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:sqlserver:// 例外:java.sql.SQLException:没有为jdbc找到合适的驱动程序:ucanaccess - Exception: java.sql.SQLException: No suitable driver found for jdbc:ucanaccess java.sql.SQLException:找不到适用于jdbc:sqlite的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc:sqlite java.sql.SQLException:找不到适合jdbc的驱动程序 - java.sql.SQLException: No suitable driver found for jdbc 错误:java.sql.SQLException:未找到适合jdbc:sqlserver的驱动程序 - Error: java.sql.SQLException: No suitable driver found for jdbc:sqlserver
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM