Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E54DA9FBE0A for ; Tue, 17 Jul 2007 15:11:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 21593-02-6 for ; Tue, 17 Jul 2007 15:11:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mx01.burntmail.com (mx01.burntmail.com [69.93.121.66]) by postgresql.org (Postfix) with ESMTP id 815C59FBE19 for ; Tue, 17 Jul 2007 15:11:24 -0300 (ADT) Received: from pool-72-66-97-101.washdc.fios.verizon.net ([72.66.97.101] helo=[127.0.0.1]) by mx01.burntmail.com with esmtpa (Exim 4.63) (envelope-from ) id 1IArW9-0000vw-1J for pgsql-jdbc@postgresql.org; Tue, 17 Jul 2007 13:11:25 -0500 Message-ID: <469D064D.5020809@burntmail.com> Date: Tue, 17 Jul 2007 14:11:25 -0400 From: Guy Rouillier User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: please checkits urgent References: <6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.com> In-Reply-To: <6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000757-3, 07/17/2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200707/77 X-Sequence-Number: 17251 durga prasad wrote: > hi > > iam durga prasad, > > iam using Postgresql8.2 when iam trying to > connect the driver is not working (org.postgresql.Driver) can please > send me the driver class of java to connect to DB,please revert to me > immediately following code i have used: pls correct and revert tome > You would get more relevant responses if you told us the error you are receiving. Most likely, you are encountering a classpath problem. Make sure the PG JAR file is in your runtime classpath. Your code below looks fine. > > > > import java.sql.*; > import java.io.*; > class Conc { > public static void main(String[] args) throws Exception { > > //Class.forName(" JDBC Driver goes here"); > > Class.forName("org.postgresql.Driver"); > > //jdbc:postgresql://host:port/database > > Connection > con=DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres","poks","aqswdefr"); > > > > Statement stmt=con.createStatement(); > > //system.out.println("Creating Table---->"); > //stmt.executeUpdate("Create table emp(eid int, ename varchar2(12))"); > > System.out.println("Inserting row--->"); > stmt.executeUpdate("Insert into emp values('bbbb',2)"); > System.out.println("One row is Inserted....."); > > System.out.println("Getting data ---->"); > > ResultSet rs=stmt.executeQuery("select * from emp"); > > while(rs.next()) > System.out.println(rs.getInt(1)+" "+rs.getString(2)); > > rs.close(); > stmt.close(); > con.close(); > } //main() > } //class > -- Guy Rouillier