pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dmp <danap@ttc-cmc.net>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC connection query..
Date: Mon, 17 Aug 2009 10:31:51 -0600
Message-ID: <4A8985F7.5090604@ttc-cmc.net> (raw)
In-Reply-To: <3f5b685a0908170149o6c28402fm7953ac29d33c7a71@mail.gmail.com>
References: <3f5b685a0908170149o6c28402fm7953ac29d33c7a71@mail.gmail.com>

> 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);
}



view thread (2+ messages)

Message-ID: <4A8985F7.5090604@ttc-cmc.net>
Permalink:  ../4A8985F7.5090604@ttc-cmc.net/
Also on:    postgresql.org/message-id/4A8985F7.5090604@ttc-cmc.net

 · 

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: danap@ttc-cmc.net
  Subject: Re: JDBC connection query..
  In-Reply-To: <4A8985F7.5090604@ttc-cmc.net>
  References: <3f5b685a0908170149o6c28402fm7953ac29d33c7a71@mail.gmail.com> <4A8985F7.5090604@ttc-cmc.net>

* 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