Обсуждение: connectivity problem
I am using postgreSQL 7.3,j2sdk1.4.2 and have installed jdbc driver as pg73jdbc3.jar Here is the classpath : exportCLASSPATH=/root/j2sdk1.4.2/bin/test1.java:/root/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/pg73jdbc3.jar:. and here is the code: import java.sql.*; class test2{ public static void main (String args[]) { try{ Class.forName("org.postgresql.Driver"); String url="jdbc:postgresql//10.1.30.10:85/test"; Connection con = DriverManager.getConnection(url, "postgres", ""); Statement stm= con.createStatement(); stm.setQueryTimeout(10); ResultSet rs = stm.executeQuery("select col1 from test1"); rs.next(); System.out.println(rs.getString(1)); }catch(ClassNotFoundException e) { System.out.println("Exception"); System.out.println(e.toString()); } catch(SQLException e) { System.out.println("Exception"); System.out.println(e.toString()); } } } and here is the error I receive : Exception java.sql.SQLException: No suitable driver ________________________________________________________________________ Yahoo! India Mobile: Download the latest polyphonic ringtones. Go to http://in.mobile.yahoo.com
On Fri, 30 Jan 2004, [iso-8859-1] adp adp wrote: > String > url="jdbc:postgresql//10.1.30.10:85/test"; You are mising a colon after postgresql. I also would be very surprised if 85 was the correct port to connect to. Based on your previous attempt to connct to localhost I would recommend using jdbc:postgresql://127.0.0.1/test Kris Jurka
On 30 janv. 2004, at 09:26, adp adp wrote: > exportCLASSPATH=/root/j2sdk1.4.2/bin/test1.java:/root/j2sdk_nb/ > j2sdk1.4.2/jre/lib/ext/pg73jdbc3.jar:. > > Might be a typo in your email but I don't find a space after the export command... try echo $CLASSPATH to check it was exported correctly. Best regards Patrick Perroud - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Patrick Perroud SARL 41 rue Barrault 75013 Paris France Europe - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - tel./fax +33-1-45652500 mobile 06 89 99 57 09 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.pperroud.com iChat AV: pp100752 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 48º 49' N 2º 20' E