Re: SSL for JDBC - Mailing list pgsql-jdbc

From Takeo Shibata
Subject Re: SSL for JDBC
Date
Msg-id DNEKLICCHCKABMLJENDEIENICMAA.shibata@areabe.com
Whole thread Raw
In response to Re: SSL for JDBC  (Oleg Samoylov <olleg@jane.telecom.mipt.ru>)
List pgsql-jdbc
Hi All
Thank you fro your helps!!.
I try those driver ,, but

I try out jdbc3 from the url
and try to execute the modified sample.

import java.sql.*;
public final class TConn {
    static final String driverClass="org.sourceforge.jxdbcon.JXDBConDriver";
    static final String
dbURL="jdbc:postgresql:net//192.168.10.10:5432/test";
    public static void main(String[] argv) {
        try {
            Class driver=Class.forName(driverClass);

            Connection
conn=DriverManager.getConnection(dbURL,"test","test");
        PreparedStatement pstSel = conn.prepareStatement("select test from test");
            ResultSet rs = pstSel.executeQuery();
        rs.next();
        System.out.println(rs.getString(1));
            rs.close();
            pstSel.close();
            //...
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

This does not work, when I enable ssl.
and use hostssl in the pg_hba.conf.

Does this driver works with the default postgresql?
How can I enabled the SSL?
Do I hvae to change any code?
org\sourceforge\jxdbcon\postgresql\NetConnection.java
Looks like recive proerty 'info' and check if is is ssl or not.
Do I have to pass the flag in property manually?

Here are the result by Java and psql command

>>>>>>>>>For pg_hba.conf with hostssl and host
# psql -h 192.168.10.10 test -u
psql: Warning: The -u option is deprecated. Use -U.
User name: test
Password: test
Welcome to psql, the PostgreSQL interactive terminal.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit
SSL connection (cipher: DES-CBC3-SHA, bits: 168)
test=> select test from test;
ok!

>>>>>>>>For pg_hba.conf with host
#java TConn
ok!

>>>>>>>For pg_hba.conf with hostssl
#java TConn
ErrorMsg: FATAL 1:  No pg_hba.conf entry for host 192.168.10.11, user test,
database test
org.sourceforge.jxutil.sql.I18nSQLException: nopghba[192.168.10.11, test,
test]
        at org.sourceforge.jxdbcon.postgresql.PGErrors.throwError(Unknown
Source)
        at org.sourceforge.jxdbcon.postgresql.PGErrors.throwError(Unknown
Source)
        at org.sourceforge.jxdbcon.postgresql.NetProtocolV2.doLogin(Unknown
Source)
        at org.sourceforge.jxdbcon.postgresql.NetProtocolV2.connect(Unknown
Source)
        at org.sourceforge.jxdbcon.postgresql.NetConnection.connect(Unknown
Source)
        at org.sourceforge.jxdbcon.postgresql.PGConnection.open(Unknown
Source)
        at org.sourceforge.jxdbcon.JXDBConDriver.connect(Unknown Source)
        at java.sql.DriverManager.getConnection(DriverManager.java:512)
        at java.sql.DriverManager.getConnec




-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Oleg Samoylov
Sent: Thursday, February 20, 2003 5:34 AM
To: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] SSL for JDBC


Takeo Shibata wrote:
> I am wondering if anybody have successfuly connected from JDBC to
PostgreSQL
> by SSL.
> Please help me!

Alternative PostgreSQL JDBC driver can connect via SSL.
https://sourceforge.net/projects/jxdbcon

--
Olleg Samoylov


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly


pgsql-jdbc by date:

Previous
From: Rich Cullingford
Date:
Subject: Can't update rows in tables qualified with schema names
Next
From: Barry Lind
Date:
Subject: Re: SSL for JDBC