From: Blaine Simpson <blaine.simpson@admc.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC connection issue
Date: Wed, 21 Jul 2004 17:47:56 -0400
Message-ID: <40FEE48C.3010208@admc.com> (raw)
In-Reply-To: <1ac22fd7.0407190027.53d75925@posting.google.com>
References: <581C48EBC132FF459E62A6809D0D72AE22C749@mail.sharedmarketing.com>
<1ac22fd7.0407190027.53d75925@posting.google.com>
Use "md5" instead of "trust". Besides trust having all sorts of
problems to do
with ident daemons, I don't even know if the JDBC driver will work with
ident,
since JDBC network drivers generally pass a username and password. First
get psql working locally before trying to get the JDBC driver to work, like
psql -h hostname -U blaine dbname
Here's a typical md5 record:
host all all 192.168.100.0 255.255.255.0 md5
Where, as you probably know, 192.168.100.0/255.255.255.0 is the permitted
source IP range.
I've worked with about a dozen network JDBC drivers over the past several
years, as a driver developer and a user. Contrary to what some
Java-phobes say,
JDBC drivers are very easy to use directly from Java clients. The
difficulty comes when vendors build shitty abstraction, pooling, and
management functions to isolate your code from the JDBC drivers. Load
your JDBC driver directly with your own code and everything is simple.
I recommend you try my SqlTool client as a utility to get your setup
working.
http://hsqldb.sourceforge.net/guide/ch07.html>>Hi,
>>
>>I am having some difficulties connecting to a local postgresql database via
>> jdbc driver.
>>
>>my setup is:
>>mandrake 10.0
>>j2sdk1.4.2
>>postgresql 7.4.3
>>
>>I've configured postgresql from its source with --with-java option, make, a
>>nd make install.
>>
>>The default directory for the postgresql.jar is /usr/local/pgsql/share/java
>>/postgresql.jar
>>I've run >jar -tf /usr/local/pgsql/share/java/postgresql.jar and the class
>>files seem to be in the right order.
>>
>>I've added the following line to the pg hba.conf to test local connections
>>via jdbc driver.
>>local all all 127.0.0.1 trust
>>
>>Also, changed the postgresql.conf
>>tcpip socket = true
>>
>>Added CLASSPATH to bashrc file
>>export CLASSPATH=/usr/local/pgsql/share/java/postgresql.jar:${CLASSPATH}
>>
>>and I am trying to run the following code
>>import java.sql.*;
>>import java.util.*;
>>
>>public class Xlang {
>> public static void main(String[] args) {
>> try {
>> Class.forName("org.postgresql.Driver");
>> ...
>> }
>>}
>>
>>and I am getting the following exception..
>>
>>java.lang.ClassNotFoundException: org.postgresql.Driver
>>
>>Any ideas would be very much appreciated.
>>
>>YJ
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 9: the planner will ignore your desire to choose an index scan if your
>> joining column's datatypes do not match
>>
>>
--
ICF: 703-934-3692 Cell: 703-944-9317
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: blaine.simpson@admc.com
Subject: Re: JDBC connection issue
In-Reply-To: <40FEE48C.3010208@admc.com>
References: <581C48EBC132FF459E62A6809D0D72AE22C749@mail.sharedmarketing.com> <1ac22fd7.0407190027.53d75925@posting.google.com> <40FEE48C.3010208@admc.com>
* 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