Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Unable to connect to Sql Server

  1. #1
    Junior Member
    Join Date
    Apr 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Unable to connect to Sql Server

    HI All,

    I have set the classpath to C:\Program Files (x86)\Java\jre7\lib\sqljdbc.jar;C:\Program Files (x86)\Java\jre7\lib\sqljdbc4.jar;

    however I am still getting:

    java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at SqlServerJDBCConnnection.main(SqlServerJDBCConnnec tion.java:24)



    thank you


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Unable to connect to Sql Server

    java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
    The program can not find a definition for the class: com.microsoft.sqlserver.jdbc.SQLServerDriver
    Find the jar file that contains that class's definition and put it on the classpath when the program is executed.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Apr 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Unable to connect to Sql Server

    thank you this was sorted by including the correct file (sqljdbc4.jar) in Eclipse Properties

Similar Threads

  1. Replies: 7
    Last Post: December 28th, 2012, 10:48 AM
  2. Connect to the server using java servlet
    By chandrababu in forum What's Wrong With My Code?
    Replies: 4
    Last Post: November 28th, 2012, 09:28 AM
  3. Connect to SQL server 2008
    By vahidbakhtiary in forum JDBC & Databases
    Replies: 1
    Last Post: July 2nd, 2012, 10:07 AM
  4. Cannot Connect to Server
    By Brt93yoda in forum Java Networking
    Replies: 0
    Last Post: December 9th, 2010, 05:54 PM
  5. Replies: 6
    Last Post: August 18th, 2010, 05:41 PM

Tags for this Thread