Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2011
    Location
    India
    Posts
    67
    Rep Power
    0

    Default No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/

    import java.sql.*;
    public class sqlServerDemo {

    public static void main(String[] args)throws Exception
    {

    String url="jdbc:microsoft:sqlserver://localhost:1433/";
    Connection con=DriverManager.getConnection(url,"sa","1234");
    if(con.isClosed()!=true)
    System.out.println("opend");
    }

    }

    i already add jar files to eclipse... But when i run this i get the follwing exceptions:

    Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at sqlServerDemo.main(sqlServerDemo.java:8)


    please help me....

    thank you in advance

  2. #2
    gimbal2 is online now Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,590
    Rep Power
    5

    Default Re: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/

    "i already add jar files to eclipse"

    - which jar(s)
    - how did you add them?
    - how are you running the code?

    And according to the official documentation (google: sqlserver jdbc), the JDBC url is different.

    Building the Connection URL

    So perhaps you're using documentation that does not match up with the version of sqlserver you're using.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    Join Date
    Sep 2011
    Location
    India
    Posts
    67
    Rep Power
    0

    Default Re: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/

    Quote Originally Posted by gimbal2 View Post
    "i already add jar files to eclipse"

    - which jar(s)
    - how did you add them?
    - how are you running the code?

    And according to the official documentation (google: sqlserver jdbc), the JDBC url is different.

    Building the Connection URL

    So perhaps you're using documentation that does not match up with the version of sqlserver you're using.

    sqljdbc4.jar file was added to reference variable place...
    in my program there are no compilation errors... but it arises exception...

  4. #4
    Join Date
    Sep 2011
    Location
    India
    Posts
    67
    Rep Power
    0

    Default Re: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/

    Quote Originally Posted by gimbal2 View Post
    Thanks for url sir... now its working...

  5. #5
    Join Date
    Sep 2011
    Location
    India
    Posts
    67
    Rep Power
    0

    Default Re: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/

    import java.sql.*;
    public class sqlServerDemo {

    public static void main(String[] args)throws Exception
    {
    //Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
    String url="jdbc:sqlserver://localhost;";
    Connection con=DriverManager.getConnection(url,"sa","1234");
    if(con.isClosed()!=true)
    System.out.println("opend");

    }

    }
    in this program work nicely but i have one doubt sir, that is, why the connection was established even i didnt specify the port number?

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: No suitable driver found for jdbc:microsoft:sqlserver://localhost:1433/

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 5
    Last Post: 03-13-2012, 01:51 PM
  2. MySQL: No suitable driver found.
    By Onra in forum JavaServer Pages (JSP) and JSTL
    Replies: 8
    Last Post: 12-15-2011, 02:41 PM
  3. No suitable driver found
    By chinna in forum New To Java
    Replies: 3
    Last Post: 11-30-2011, 01:17 PM
  4. No suitable driver found
    By geekchick in forum New To Java
    Replies: 2
    Last Post: 08-25-2010, 12:12 AM
  5. Replies: 1
    Last Post: 10-16-2008, 02:09 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
  •