Re: JDBC connection query..

Поиск
Список
Период
Сортировка
От dmp
Тема Re: JDBC connection query..
Дата
Msg-id 4A8985F7.5090604@ttc-cmc.net
обсуждение исходный текст
Ответ на JDBC connection query..  (Monu Z <zmonu2008@gmail.com>)
Список 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);
}

В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Michael Bell
Дата:
Сообщение: Re: JDBC Connection broken (followup)
Следующее
От: Michael Bell
Дата:
Сообщение: Re: JDBC broken connection against Postgres 8.4