Re: JDBC connection query..

From: dmp <danap(at)ttc-cmc(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC connection query..
Date: 2009-08-17 16:31:51
Message-ID: 4A8985F7.5090604@ttc-cmc.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

> Hi,
>
> I am working with Jdeveloper 11, Java 1.6 and Postgresql 8.3 on Windows.
>
> I got the jdbc driver postgresql-8.3-604.jdbc2,
> postgresql-8.3-604.jdbc2ee, postgresql-8.3-604.jdbc3 and
> postgresql-8.3-604.jdbc4.
>
> Please help to me to establish database connection in Jdeveloper.
> Please give me step-by-step complete details of how to establish
> connection between Jdeverloper and postgresql8.3.
>
> Thanks & Regards
> Monu Zacharia

Hello,
The standard piece of Java code for establishing a connection
to a PostgreSQL database is listed below. Perhaps a posting to
a JDeveloper community or referencing its documentation might
be more helpful.

danap

try{
Class.forName("org.postgresql.Driver").newInstance();
}
catch (Exception e){
System.err.println("Unable to find and load driver" + e);
}

try{
Connection dbConnection;
String connectionProperties;
String host, port, db, user, passwordString;

host = "localhost";
port = "5432";
db = "mydatabase";
user = "danap";
passwordString = "mypassword";

connectionProperties = "jdbc:postgresql://" + host + ":" + port
+ "/" + db + "?user=" + user
+ "&password=" +
passwordString;
// System.out.println(connectionProperties);
dbConnection = DriverManager.getConnection(connectionProperties);
}
catch (SQLException e)
{
System.err.println(e);
}

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Michael Bell 2009-08-17 19:55:40 Re: JDBC broken connection against Postgres 8.4
Previous Message Michael Bell 2009-08-17 16:00:42 Re: JDBC Connection broken (followup)