suitable driver not found - Mailing list pgsql-admin

From rajitha m
Subject suitable driver not found
Date
Msg-id 20041209060837.93127.qmail@web10911.mail.yahoo.com
Whole thread Raw
List pgsql-admin
 
The code given below gives an exception as:
a suitable driver not found. 
I am not working on a network, it is a simple stand alone PC.
 
Which SqlDriverr would be suitable,I am using SqlServerDriverfor SQl database 7.0,j2sdk1.41_01 and have installed SqlServerDriver driver sqlserverdriver.jar

and put it in j2sdk1.41_01/jre/lib/ext/sqlserverdriver.jar and then set the classpath
but while running this program i am getting the error like:
 
  classnotfound exception:java.lang.classnotfoundexception:com.microsoft.jdbc.sql
server:SqlServerDriver
sqlexception:java.sql.sqlexception:no suitabledriver
 
and code is:
 
  import java.sql.*;
import javax.sql.*;
import java.io.*;
import java.lang.*;
public class connect
{ public static void main(String[] args)
 { String url = "jdbc:microsoft:sqlserver://idealab5.cs.uiowa.edu:1433;DatabaseName=Entertainment;";
// here Entertainment is database name
  String uid = "admin";
  String pw = "";
  try { // Load driver class
   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
  }
  catch (java.lang.ClassNotFoundException e) {
   System.err.println("ClassNotFoundException: " +e);
  }
  Connection con = null;
  try {
   con = DriverManager.getConnection(url,uid,pw);
   Statement stmt = con.createStatement();
   ResultSet rst = stmt.executeQuery("SELECT * FROM USERS");
   //System.out.println("Product Name, Price");
   while (rst.next())
   { System.out.println(rst.getString(1));//+","+rst.getDouble(2));
   }
  }
  catch (SQLException ex)
  {
   System.err.println("SQLException: " + ex);
  }
  finally
  {
   if (con != null)
    try
    {
     con.close();
    }
    catch (SQLException ex)
    {
     System.err.println("SQLException: " + ex);
    }
  }
 }
}
 


Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.

pgsql-admin by date:

Previous
From: "Gayatri Ganpaa"
Date:
Subject: problem with JDBC connection on gumbo nodes
Next
From: "Ari Johannesson"
Date:
Subject: How to temporarily disable referntial integrity?