Re: SSL for JDBC

From: "Takeo Shibata" <shibata(at)areabe(dot)com>
To: "Oleg Samoylov" <olleg(at)jane(dot)telecom(dot)mipt(dot)ru>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: SSL for JDBC
Date: 2003-02-27 00:14:58
Message-ID: DNEKLICCHCKABMLJENDEIENICMAA.shibata@areabe.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Oleg Samoylov
Sent: Thursday, February 20, 2003 5:34 AM
To: pgsql-jdbc(at)postgresql(dot)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(at)postgresql(dot)org so that your
message can get through to the mailing list cleanly

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Joel Franco Guzmán 2003-02-27 03:42:11 Sun J2SE 1.4 + postgresql-jdbc3-7.3.jar + Postgresql 7.2.1 and getParameterMetaData() fail
Previous Message Rich Cullingford 2003-02-26 20:32:56 Can't update rows in tables qualified with schema names