JDBC Driver
От | vijayendra mohan agrawal |
---|---|
Тема | JDBC Driver |
Дата | |
Msg-id | 001f01c06402$0a8e8b40$2a14a8c0@Protea.wipro.com обсуждение исходный текст |
Список | pgsql-admin |
Hi all, I want to use PostGreSQL in my Java application. I have compiled jdbc2 since I am using JDK1.2 I have placed the jar file in my CLASSPATH. I am trying to connect to PostGreSQL server running in HP-UX machine connected to my PC through LAN. In my machine, I am working in Windows 95 platform. The following piece of code depicts, how I am trying to connect to the server. But it returns false for acceptsURL() call itself and throws SQLException. In the HP-UX machine, where I am running PostGreSQL server, I didn't see port 5432 in /etc/services. Shall I add one entry with this port number here. What else might be required ? try { Class.forName("org.postgresql.Driver"); org.postgresql.Driver dr = new org.postgresql.Driver(); System.out.println("driver accepts URL :" + dr.acceptsURL("jdbc:org.postgresql://192.168.20.19:5432/avijaynesimdb")); System.out.println("Connecting to "+url); con = DriverManager.getConnection(url,usr,pwd); System.out.println("Connected "+con); st = con.createStatement(); } catch(ClassNotFoundException cnfe) { System.out.println("Could not find JDBC driver. Please check the CLASSPATH. " + cnfe.getMessage()); } catch(SQLException sqle) { System.out.println("Could not connect to database. " + "Please check whether the database server is running or not. " + sqle.getMessage()); } Thank You, Best Regards, Vijay ************************************************************ Vijayendra Mohan Agrawal Wipro Technologies 26, Hosur Main Road, Bommanhalli, Bangalore-560068, India Tel: 91-80-5722296 Extn:3076 Fax: 91-80-5722696 E-mail : Vijayendra.Agrawal@wipro.com **************************************************************
В списке pgsql-admin по дате отправления: