On the treatment of Java.lang.ClassNotFoundException:com.microsoft.jdbc.sqlserver.SQLServerDriver

Source: Internet
Author: User

Wrote a Java program in Notepad, connected to SQL Server 2008, downloaded the Microsoft JDBC from the Internet (address: http://msdn.microsoft.com/zh-cn/data/ aa937724.aspx), compile no problem, the execution of the time will be reported error: Java.lang.ClassNotFoundException: Com.microsoft.jdbc.sqlserver.SQLServerDriver the solution, the JDBC package has been placed in the source directory AH?! Later, the JDBC package is placed in the JRE related directory Jre\lib\ext, it is possible.

PS. You can compile without the need for the JDBC driver package, as long as the runtime can find the driver package under Jre\lib\ext. Another: Microsoft's JDBA drive contains a low version and a high version, if it is connected to SQL2008, it is best to remove the lower version of the JDBC, because the runtime may catch the lower version of the Jdbc**.jar.


Attach the steps for writing a Java program in Notepad:

1. Install the JDK. Open cmd after installation, execute Java and Javac successfully

2, create a program with Notepad and save it as a Java file. Note that the class name must match the file name, and Java is case-sensitive

3,cmd window, switch to this directory, compile with Javac Xxxxx.java. Add-classpath parameters when necessary

4. Place the necessary jar packages under the Jre\lib\ext

5, execute Java program with Java xxxxx

On the treatment of Java.lang.ClassNotFoundException:com.microsoft.jdbc.sqlserver.SQLServerDriver

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.