Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClassNotFoundException when connecting to MS SQLServer using JDBC

I'm trying to connect to a MSSQL using the MS JDBC Driver (Microsoft SQL Server JDBC Driver 3.0: http://www.microsoft.com/download/en/details.aspx?id=21599) but what every i do i get java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver when i run the project in Netbeans.

I am running Netbeans 7.1 on Windows 7 Enterprise 64-bit. I have gone through quite a few guides on the web on how to setup the MSSQL JDBC driver but I know I'm missing something. Does anyone have a fool/idiot proof guide to setting this up, I don't care how basic it is. I'm sure its something in my enviroment that isn't correct and I'm only just starting out with Java and Netbeans so I suspect I've overlooked something.

like image 393
Adam_B Avatar asked Jan 18 '23 09:01

Adam_B


1 Answers

You might have the package for the SQLServerDriver class incorrect. Try "com.microsoft.sqlserver.jdbc.SQLServerDriver" instead of "com.microsoft.jdbc.sqlserver.SQLServerDriver".

like image 135
drew Avatar answered Feb 01 '23 09:02

drew