pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: durga prasad <kdgprasad@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: please checkits urgent
Date: Tue, 17 Jul 2007 17:32:23 +0530
Message-ID: <6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.com> (raw)

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




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

view thread (2+ messages)  latest in thread

Message-ID: <6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.com>
Permalink:  ../6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.com/
Also on:    postgresql.org/message-id/6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.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-jdbc@postgresql.org
  Cc: kdgprasad@gmail.com
  Subject: Re: please checkits urgent
  In-Reply-To: <6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.com>
  References: <6dd360360707170502sc830adbl521ec6a784ff9725@mail.gmail.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