Classpath set, but: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver

后端 未结 6 1536
感动是毒
感动是毒 2020-12-11 05:39

Okay, I\'m confused. My SQL Server JAR is here:

     Volume in drive C has no label.
 Volume Serial Number is 8008-2D93

 Directory of c:\\temp

03/07/2014           


        
相关标签:
6条回答
  • 2020-12-11 06:11

    copy sqljdbc4.jar under WebContent-->WEB_INF -->lib folder. This resolved my problem.

    0 讨论(0)
  • 2020-12-11 06:16

    If you pass -jar to java.exe then the classpath is taken from the specified Jar file's manifest; all external classpath settings (e.g. %CLASSPATH%) are ignored.

    Do one of:

    1. Use java -cp ...\myapp.jar MainClassName

    2. Put sqljdbc.jar into the Class-Path field in myapp.jar's manifest.

    3. Discover and load sqljdbc.jar programmatically.

    0 讨论(0)
  • 2020-12-11 06:19

    set the class path for sqljdbc4.jar

    CLASSPATH= D:\sqljdbc_4.0.2206.100_enu\sqljdbc_4.0\enu\sqljdbc4.jar;
    

    if you are eclipse user remove unnecessary .jar file sqljdbc

    0 讨论(0)
  • 2020-12-11 06:20

    If you programme application ZK, then put sqljdbc4.jar in the folder WebContent -> WEB_INF -> lib .

    Reference: Anand's comment.

    0 讨论(0)
  • 2020-12-11 06:25

    I got this error after updating my Eclipse STS, it turned out my server forgot all of its configuration info during the update. I had to set up the server's classpath and environment variables all over again and that fixed the issue.

    0 讨论(0)
  • 2020-12-11 06:30

    Open a new command prompt, and try with steps as below, its not good to work inside C:\WINDOWS\system32

    The issue says the sqljdbc4.jar is not properly set in the classpath.

            C:\Test
            set classpath=%classpath%;.;c:\temp\sqljdbc4.jar
            java -jar "C:\Users\MYUSER\Documents\NetBeansProjects\myappSource\dist\myappSource.jar" -u MYUSER -p MYPASS -j "jdbc:sqlserver://127.0.0.1\\msqlserver:1433;database=MYDB"
    
    0 讨论(0)
提交回复
热议问题