JDBC MS SQL error no suitable driver

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nurmaiza
    New Member
    • May 2007
    • 5

    #1

    JDBC MS SQL error no suitable driver

    Hello, i'm using windows, eclipse, Tomcat 5.5 and JSP file trying to connect jdbc ms sql using jdts driver.
    i've download the driver and assigned the path at en.variable..bu t it give me an error no suitable driver

    anyone ve idea on what the setting shud i set?i've no idea after followed some instruction on web site still it give me the same error.

    this is my code

    <title>Obtain connection</title>
    </head>
    <body>
    <!--This Page Obtains a Connection to MS SQL Database-->
    <%
    Connection conn = null;
    ResultSet result = null;
    Statement stmt = null;


    try {
    Class c = Class.forName(" net.sourceforge .jtds.jdbc.Driv er");
    }
    catch (Exception e) {
    System.out.prin tln("Error occurred at line 18");
    }
    try {
    <!--jdbc:jtds:<serv er_type>://<server>[:<port>][/<database>][;<property>=<va lue>[;...]]-->

    String url="jdbc:jdts: sqlserver://localhost:1433/JIT;tds=8.0;las tupdatecount=tr ue";
    conn = DriverManager.g etConnection(ur l,"jitUser","12 3abc" );
    }
    catch (SQLException e) {
    System.out.prin tln("Error occurred "e);
    }
    try {
    stmt = conn.createStat ement();
    result = stmt.executeQue ry("SELECT * FROM dbo.attcourse") ;
    }
    catch (SQLException e) {
    System.out.prin tln("Error occurred "e);
    }

    %>
Working...