简体   繁体   English

似乎无法将JDBC sql server驱动程序连接到java eclipse项目

[英]Cant seem to connect the JDBC sql server driver to java eclipse project

I'm trying to setup the connect from my sql server database to my project but when i try to compile it i get: 我正在尝试从我的sql server数据库到我的项目设置连接但是当我尝试编译它时,我得到:

    java.sql.SQLException: No suitable driver found for jdbc.odbc:login_DSN
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at SelfPractice.main(SelfPractice.java:13)

I'm very much new to this. 我对此非常陌生。 i went to controlPanel>adminstrive tools>data sources and there added a data source called login_DSN . 我去了controlPanel> adminstrive工具>数据源,并添加了一个名为login_DSN的数据源。 i've looked in older posts and they say to include the driver jar file in class path which i think i did(i downloaded the jdbc driver from microsoft website and loaded it to a 'referenced library' in eclipose, but i still get this error message. How do i solve my driver problem? 我查看了较旧的帖子,他们说要在类路径中包含驱动程序jar文件,我认为我做了(我从微软网站下载了jdbc驱动程序并将其加载到eclipose的'引用库',但我仍然得到这个错误信息。如何解决我的驱动程序问题?

If you want to add mysql driver to eclipse project classpath you need to follow these steps: 1. Go to Project Explorer Window of Eclipse, Right click on the project, select Properties . 如果要将mysql驱动程序添加到eclipse项目类路径,则需要执行以下步骤:1。转到Eclipse的Project Explorer窗口,右键单击该项目,选择Properties 2. Click on Java Build Path from list of properties and then select Libraries tab 3. Click on Add External JARs button to add mysql_connector.jar(which you have downloaded earlier) to your project's classpath. 2.从属性列表中单击Java Build Path ,然后选择Libraries选项卡3.单击Add External JARs按钮将mysql_connector.jar(您之前已下载的)添加到项目的类路径中。

Hope this helps. 希望这可以帮助。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM