suitable driver not found

From: rajitha m <rajita_mp(at)yahoo(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: suitable driver not found
Date: 2004-12-09 06:08:37
Message-ID: 20041209060837.93127.qmail@web10911.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Browse pgsql-admin by date

  From Date Subject
Next Message Nageshwar Rao 2004-12-09 08:31:24 runing Postgresql on shared disk
Previous Message Bjoern Metzdorf 2004-12-08 21:15:44 statistics buffer is full