Results 1 to 3 of 3
  1. #1
    Brad is offline Member
    Join Date
    Feb 2012
    Posts
    21
    Rep Power
    0

    Default JTDS Driver Cannot be Found

    I am using Netbeans to build an app that connects to a database server to do some tasks (create databases, queries, etc.).

    When I run my app from within Netbeans it creates databases just fine.

    When I run my app from c:\Temp (or anywhere outside or Netbeans) I get an error that says net.sourceforge.jtds.jdbs.Driver.

    So it looks like it can find the driver that I added to the Classpath within Netbeans, but it can't find the driver when the app is run from outside of my IDE.

    When I open up a DOS prompt and echo the Classpath it shows the driver:
    c:\Temp>echo %CLASSPATH%
    C:\jtds\jtds-1.3.0.jar;C:\mysql-connector-java-5.1.18\mysql-connector-java-5.1.1
    8-bin.jar;C:\Program Files (x86)\IBM\RationalSDLC\ClearQuest\cqjni.jar

    Any ideas?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,354
    Rep Power
    6

    Default Re: JTDS Driver Cannot be Found

    How do you run the application? If you use java -jar (so it is an executable jar), the CLASSPATH environmental variable is ignored. The jar itself controls the classpath, through the class-path line in the META-INF/manifest.mf file.

    As far as I remember from using Netbeans, it will put the proper dependency jars in a lib subdirectory for you. You need to distribute your application jar with that lib directory relative to it.

  3. #3
    Brad is offline Member
    Join Date
    Feb 2012
    Posts
    21
    Rep Power
    0

    Default Re: JTDS Driver Cannot be Found

    That worked! Thanks for the help.

    I have been staring at this for a couple of days now trying to get it to work :)

Similar Threads

  1. JTDS Driver problems
    By Brad in forum New To Java
    Replies: 0
    Last Post: 04-26-2013, 04:40 PM
  2. No suitable driver found
    By chinna in forum New To Java
    Replies: 3
    Last Post: 11-30-2011, 02:17 PM
  3. sql server express + tomcat 7 + jtds driver
    By DJSKYLINE in forum JDBC
    Replies: 3
    Last Post: 07-14-2011, 11:11 AM
  4. Replies: 0
    Last Post: 03-01-2010, 02:03 PM
  5. Replies: 0
    Last Post: 12-18-2007, 07:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •