connectivity problem

From: adp adp <adp_group2004(at)yahoo(dot)co(dot)in>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: connectivity problem
Date: 2004-01-30 04:00:31
Message-ID: 20040130040031.61226.qmail@web8105.in.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

You asked for code,it is given below:

and the classpath is:
exportCLASSPATH=/root/j2sdk1.4.2/bin/test1.java:/root/j2sdk_nb/j2sdk1.4.2/jre/lib/ext/pg73jdbc3.jar:.

import java.sql.*;
class test2{
public static void main (String args[]) {


try{


Class.forName("postgresql.Driver");
// DriverManager.registerDriver(new (Driver));




String url="jdbc:postgresql: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());
}
}
}

please help me I have been trying to get connectivity
for a long time.

________________________________________________________________________
Yahoo! India Mobile: Download the latest polyphonic ringtones.
Go to http://in.mobile.yahoo.com

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2004-01-30 04:06:11 Re: connectivity problem
Previous Message Josh Berkus 2004-01-29 23:22:13 Re: java.lang.StringIndexOutOfBoundsException: String index