This error comes when you try to connect to Microsoft SQL Server using Microsoft's official JDBC driver bundled in sqljdbc4.jar, but the driver class is not available in Classpath. In order to make a JDBC connection, the first step is to load the class which implements JDBC Driver interface, com.microsoft.sqlserver.jdbc.SQLServerDriver is the class which does that for MSSQL. This class is bundled in sqljdbc4.jar and if this JAR is not present in Classpath then ClassLoader is not able to locate it and throws "java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver" error. How do you fix this error? just add sqljdbc4.jar or sqljdbc4.jar
Here is an example program which can cause this error
Here is an example program which can cause this error
No comments:
Post a Comment
Feel free to comment, ask questions if you have any doubt.