classNotFoundException in Loading JDBC Driver

前端 未结 3 1775
花落未央
花落未央 2020-12-18 17:41

I am a newbie in java and I\'m developing a Java EE application on the Netbeans 6.9.1 IDE. I have to connect my java application with SQL Server 2005.

For that I ha

3条回答
  •  梦毁少年i
    2020-12-18 18:00

    You need to check the JDBC driver documentation which came along with your SQL server version. In the old SQL Server 2000, the JDBC driver class name is like as you have:

    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    

    However, since SQL Server 2005, Microsoft changed the JDBC driver class name:

    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    

    Fix it accordingly.

    Please note that the CLASSPATH environment variable is ignored by Netbeans and all other decent Java programs. Forget about it and don't even try to set it until you understand why it exists and what it is to be used for.

提交回复
热议问题