ClassNotFoundException when trying to connect to SQL server 2005 with Java

前端 未结 3 468
深忆病人
深忆病人 2021-01-22 10:15

I\'m fairly new to database management. I\'m just trying to connect to the database and retrieve and display a table in the command prompt. The database is not on my computer. I

相关标签:
3条回答
  • 2021-01-22 10:43

    It means that sqljdbc4.jar is missing from your CLASSPATH while running the code. If you are running this from command line then add the path to sqljdbc4.jar in -cp switch of java command.

    If you are running from eclipse, then add sqljdbc4.jar in your build path.

    0 讨论(0)
  • 2021-01-22 10:54

    Add sqljdbc4.jar in your classpath.

    If you are using Eclipse then you can right click on project -> properties -> java build path. Go to libraries and click on add external jar. Then add the jdbc driver jar.

    Hope this helps.

    0 讨论(0)
  • 2021-01-22 11:01

    You have to add the JDBC driver to your project class path: example if you are using Eclipse put the jar in the 'lib' folder

    0 讨论(0)
提交回复
热议问题