pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: rajitha m <rajita_mp@yahoo.com>
To: pgsql-admin@postgresql.org
Subject: suitable driver not found
Date: Wed, 8 Dec 2004 22:08:37 -0800 (PST)
Message-ID: <20041209060837.93127.qmail@web10911.mail.yahoo.com> (raw)

  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.

Message-ID: <20041209060837.93127.qmail@web10911.mail.yahoo.com>
Permalink:  ../20041209060837.93127.qmail@web10911.mail.yahoo.com/
Also on:    postgresql.org/message-id/20041209060837.93127.qmail@web10911.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: rajita_mp@yahoo.com
  Subject: Re: suitable driver not found
  In-Reply-To: <20041209060837.93127.qmail@web10911.mail.yahoo.com>
  References: <20041209060837.93127.qmail@web10911.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox