Cannot load JDBC driver class

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #330763 Reply

    John Bender

    Having problems integrating Tomcat 7 with MyEclipse debugger using jtds JDBC connector. I can connect to my localhost SQL Server 2008 instance using the MyEclipse Database Explorer Perspective using the following URL: jdbc:jtds:sqlserver://localhost:1433/VendorPortalDemo;. However when I try to debug using the integrated Tomcat 7 server I get the following error: “Cannot load JDBC driver class ‘net.sourceforge.jtds.jdbc.Driver’ ”
    . The jtds-1.2.6.jar file is in my /WebRoot/WEB-INF/lib folder and the Java Build Path looks good.

    Here is my context.xml file:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <Context antiJARLocking=”true” path=”/CFO”>

    <Resource name=”jdbc/SpendAnalyticsDB” auth=”Container”
    type=”javax.sql.DataSource” username=”vendorportal” password=”secret”

    Database name is VendorPortalDemo.

    Here s the Java code that I’m using to connect:

    Context initContext = new InitialContext();
    Context webContext = (Context)initContext.lookup(“java:/comp/env”);
    DataSource ds = (DataSource) webContext.lookup(“jdbc/SpendAnalyticsDB”);
    Connection con = ds.getConnection();

    The exception is thrown on the ds.getConnection(); line.
    Exception is: “Cannot load JDBC driver class ‘net.sourceforge.jtds.jdbc.Driver’ ”

    Any thoughts would be appreciated. I’ve also tried this with the Microsoft JDBC connector with very similar results.


    #330768 Reply


    I could not replicate the issue at my end.

    Can you please check whether the jtds-1.2.6.jar file is in your projects deployment location ? If not please verify your Library deployment policies under project properties > MyEclipse > Web > Deployment tab.

    Let us know how it works for you.

    #330780 Reply

    John Bender

    I have checked the Deployment tab and I am using the default MyEclipse settings. (Use Smart Deployment, all check boxes are checked). On the build Path tab, I have selected “Yes” Automatically add WEB-INF/lib/*.jar to Web Project build-path.

    The jtds-1.2.6.jar file is in the project WEB-INF/lib folder.
    I also checked in the MyEclipse Tomcat base directory ( workspace\.metadata\.me_tcat) and I see the .jar file is also there in the WEB-INF/lib folder for my project.

    Note that if I build a WAR file and deploy it to Tomcat (outside of MyEclipse), it does find the jar file and everything works as expected. Somehow, MyEclipes Tomcat is not seeing the .jar file.

    My project build path does have this .jar file included.

    Any other suggestions?


    #330826 Reply


    Can you please copy the jtds-1.2.6.jar file into common>plugins>com.genuitec.eclipse.easie.tomcat.myeclipse_9.0.0.me201109141806>tomcat>lib folder and try to replicate the issue ?

    Take a look at this FAQ for information on the ‘common’ folder location along with other MyEclipse files and folders locations :

    Let us know how it works for you.

    #330910 Reply

    John Bender

    What finally worked for me was to add the .jar file to the server configuration.

    In the server view, right click on MyEclipse Tomcat. Select “Configure Server Connector”.
    Click on “MyEclipse–> Servers–>Integrated Sandbox–>MyEclipse Tomcat–>Paths. Add the .jar to the “Append To Classpath” section.

    Note that I’m using MyEclipse 10.6


    #330938 Reply


    Glad that you got it working.
    Let us know if you see any issues.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Cannot load JDBC driver class

You must be logged in to post in the forum log in