Results 1 to 5 of 5
  1. #1
    Join Date
    May 2002
    Posts
    1

    Unanswered: No Suitable Driver

    Hi

    I installed the free software MS SQL Server 2000 from microsoft.com.
    I installed the JDBC driver from the following microsoft link
    http://msdn.microsoft.com/downloads/...mpositedoc.xml


    I set the classpath to point to the jar files in the lib folder in the driver I downloaded.

    I wrote the following test file to test the connectivity import java.io.*;
    import java.sql.*;

    public class Test
    {

    public static final String DB_URL = "jdbc:JDataConnect://localhost/testdb";
    public static final String DB_USERNAME = "";
    public static final String DB_PASSWORD = "";
    public static final String DB_DRIVER = "com.microsoft.jdbc.base.BaseDriver";


    public static void main(String args[])
    {

    ResultSet rs = null;
    try
    {
    Class.forName (DB_DRIVER);
    Connection conn=DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);

    System.out.println("Connection established");
    }
    catch(Exception e)
    {
    System.out.println("An exception has occurred" +e);
    }
    }
    }

    when I run this code using java Test after successful compilation I get the following error

    An exception has occurredjava.sql.SQLException: No suitable driver


    Please Help !!!!

    Thanks in Advance

    Plum

  2. #2
    Join Date
    Oct 2002
    Posts
    2
    Try this

    it working for me

    import java.io.*;
    import java.sql.*;

    public class Test
    {

    public static final String DB_URL = "jdbc:microsoft:sqlserver://server1ort1";
    public static final String DB_USERNAME = "sa";
    public static final String DB_PASSWORD = "a108810";
    public static final String DB_DRIVER = "com.microsoft.jdbc.sqlserver.SQLServerDriver" ;

    public static void main(String args[])
    {

    ResultSet rs = null;
    try
    {
    Class.forName (DB_DRIVER);
    Connection conn=DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);

    System.out.println("Connection established");
    }
    catch(Exception e)
    {
    System.out.println("An exception has occurred" +e);
    }
    }
    }

  3. #3
    Join Date
    Nov 2002
    Posts
    2
    When I tried to run your Test code.

    An exception has occurredjava.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

    I setup CLASSPATH to the 3 jar files which downloaded from microsoft.com, and I do not know WHY??


    James

  4. #4
    Join Date
    Oct 2002
    Posts
    2

    ClassNotFoundException:com.microsoft.jdbc.sqlserve r.SQLServerDriver

    the same siatuation happened to me
    sometimes drivers cannot be found in jar files
    try unpack the jar files in your work directory

    Originally posted by james_hu
    When I tried to run your Test code.

    An exception has occurredjava.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

    I setup CLASSPATH to the 3 jar files which downloaded from microsoft.com, and I do not know WHY??


    James

  5. #5
    Join Date
    Nov 2002
    Posts
    2

    Can't put any space between ";"!!!!

    Hi,

    My problem solved, I put space between ";" for CLASSPATH.
    classpath=.; c:\..\msbase.jar; c:\..

    MUST be classpath=.;c:\..\msbase.jar;c:\..
    NO SPACE for classpath!!!

    This is stupid JAVA, it should be improve later, this problem wastes my huge time!!!

    I am not sure this is your prolem.


    James

Posting Permissions

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