Results 1 to 4 of 4
  1. #1
    chinna is offline Member
    Join Date
    Jul 2011
    Posts
    14
    Rep Power
    0

    Default No suitable driver found

    Dear Gurus,

    I tried to connect sql server from java but error occured "No suitable driver found".
    I've already add jtds-1.2.5.jar, sqljdbc.jar, sqljdbc4.jar.

    Below is my code sample:
    Java Code:
    Connection conn ;
    conn = DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.50.6:1433/pcms_tm_test", "sa", "password");         
    stmt = conn.createStatement();                        
    stmt.executeUpdate(sql);            
    stmt.close();
    Appreciate if someone can help me on this. Thanks.

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: No suitable driver found

    Have you loaded the driver?
    Class.forname("whatever the driver class is");?

    If so (and there's no ClassNotFoundException), then the above connection string is possibly wrong, so check the docs for jtds.

  3. #3
    chinna is offline Member
    Join Date
    Jul 2011
    Posts
    14
    Rep Power
    0

    Default Re: No suitable driver found

    Java Code:
    Connection conn ;
    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();  
    conn = DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.50.6:1433/pcms_tm_test", "sa", "password");           
    stmt = conn.createStatement();                        
    stmt.executeUpdate(sql);            
    stmt.close();
    Same error "No suitable driver found".

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: No suitable driver found

    Because you are loading the ms driver, and giving the connection string for the jtds driver.

    Pick either the jtds one or the MS one...and that includes having them on your apps classpath. You only need one.

Similar Threads

  1. Replies: 6
    Last Post: 09-01-2010, 11:29 AM
  2. No suitable driver found exception error
    By Crazy Caveman in forum Networking
    Replies: 1
    Last Post: 09-01-2010, 12:03 AM
  3. No suitable driver found
    By geekchick in forum New To Java
    Replies: 2
    Last Post: 08-25-2010, 12:12 AM
  4. Which is the most suitable IDE ?
    By javaamateur in forum NetBeans
    Replies: 2
    Last Post: 10-11-2009, 11:21 AM
  5. Replies: 13
    Last Post: 03-16-2009, 09:37 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
  •