Thread: JDBC connection issue

JDBC connection issue

From
"Young Nam"
Date:
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, and 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

Re: JDBC connection issue

From
Kris Jurka
Date:

On Tue, 13 Jul 2004, Young Nam wrote:

> 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

You need to use "host" not "local" here.  Local is only for unix sockets
which cannot be used with Java.

> Added CLASSPATH to bashrc file
> export CLASSPATH=/usr/local/pgsql/share/java/postgresql.jar:${CLASSPATH}
>
> java.lang.ClassNotFoundException: org.postgresql.Driver
>

When you check the classpath with something like echo $CLASSPATH is it set
as you specified?

Kris Jurka


Re: JDBC connection issue

From
"Young Nam"
Date:
Ok.  I've changed the pg_hba.conf from 'local' to 'host' but still the same exception.

java.lang.ClassNotFoundException: org.postgresql.Driver

echo $CLASSPATH returns the correct value
/usr/local/pgsql/share/java/postgresql.jar

Does it have anything to do with reinstalling postgresql?  I've installed the postgresql before but I've deleted the
directoryinto which it was installed /usr/local/pgsql and rebuilt it from the source with the --with-java option. 

Thanks,

YJ

-----Original Message-----
From: Kris Jurka [mailto:books@ejurka.com]
Sent: Tuesday, July 13, 2004 11:41 AM
To: Young Nam
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] JDBC connection issue




On Tue, 13 Jul 2004, Young Nam wrote:

> 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

You need to use "host" not "local" here.  Local is only for unix sockets
which cannot be used with Java.

> Added CLASSPATH to bashrc file
> export CLASSPATH=/usr/local/pgsql/share/java/postgresql.jar:${CLASSPATH}
>
> java.lang.ClassNotFoundException: org.postgresql.Driver
>

When you check the classpath with something like echo $CLASSPATH is it set
as you specified?

Kris Jurka


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Re: JDBC connection issue

From
Kris Jurka
Date:

On Tue, 13 Jul 2004, Young Nam wrote:

> Ok.  I've changed the pg_hba.conf from 'local' to 'host' but still the
> same exception.

Right, this is unrelated to the problem you mentioned, but this would be
the next problem you would run into after solving your original problem.

> echo $CLASSPATH returns the correct value
> /usr/local/pgsql/share/java/postgresql.jar
>

This cannot be the classpath that you are actually using.  If so it
couldn't find your test program.  Are you providing a -cp or -classpath
argument on the java command line when running the test program?  If so
this is overriding the environment variable.  You need to get both the jar
file and the test program into the same classpath.  It doesn't matter if
it's the environment or command line one, but it needs to be the same.

Kris Jurka

Re: JDBC connection issue

From
"Young Nam"
Date:
Thanks for speedy replies, Kris.

I've included both jar files in the CLASSPATH.  Same error.

YJ

-----Original Message-----
From: Kris Jurka [mailto:books@ejurka.com]
Sent: Tuesday, July 13, 2004 12:58 PM
To: Young Nam
Cc: pgsql-jdbc@postgresql.org
Subject: RE: [JDBC] JDBC connection issue




On Tue, 13 Jul 2004, Young Nam wrote:

> Ok.  I've changed the pg_hba.conf from 'local' to 'host' but still the
> same exception.

Right, this is unrelated to the problem you mentioned, but this would be
the next problem you would run into after solving your original problem.

> echo $CLASSPATH returns the correct value
> /usr/local/pgsql/share/java/postgresql.jar
>

This cannot be the classpath that you are actually using.  If so it
couldn't find your test program.  Are you providing a -cp or -classpath
argument on the java command line when running the test program?  If so
this is overriding the environment variable.  You need to get both the jar
file and the test program into the same classpath.  It doesn't matter if
it's the environment or command line one, but it needs to be the same.

Kris Jurka

Re: JDBC connection issue

From
Kris Jurka
Date:

On Tue, 13 Jul 2004, Young Nam wrote:

> Thanks for speedy replies, Kris.
>
> I've included both jar files in the CLASSPATH.  Same error.
>

What exactly is the CLASSPATH and what exact command are you running java
with?

Kris Jurka

Re: JDBC connection issue

From
Jan de Visser
Date:
On July 13, 2004 02:05 pm, Young Nam wrote:
> I've included both jar files in the CLASSPATH.  Same error.

But you still haven't shown us how you start your program...

JdV!!

--
--------------------------------------------------------------
Jan de Visser                     jdevisser@digitalfairway.com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

Re: JDBC connection issue

From
"Young Nam"
Date:
CLASSPATH is set to
/usr/local/pgsql/share/java/postgresql.jar:/home/youngnam/Development/java_apps/xlang/bin/Xlang.jar

I am using ant to build the source files and create jar file.
In build.xml file, target that runs the program is,

<target name="run" depends="build">
  <java jar="${target}" fork="true"/> where ${target} is bin/Xlang.jar
</target>

Thanks again,

YJ

-----Original Message-----
From: Kris Jurka [mailto:books@ejurka.com]
Sent: Tuesday, July 13, 2004 1:07 PM
To: Young Nam
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] JDBC connection issue




On Tue, 13 Jul 2004, Young Nam wrote:

> Thanks for speedy replies, Kris.
>
> I've included both jar files in the CLASSPATH.  Same error.
>

What exactly is the CLASSPATH and what exact command are you running java
with?

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Re: JDBC connection issue

From
"Young Nam"
Date:
Here is the build.xml file that I use to build, and test the program.

<project name="Xlang" basedir="." default="run">
  <property name="target" value="bin/${ant.project.name}.jar"/>
  <target name="build">
    <mkdir dir="build"/>
    <mkdir dir="bin"/>

    <javac srcdir="src" destdir="build" debug="true"/>
    <jar destfile="${target}" index="true" basedir="build" includes="**/*.class">
      <manifest>
        <attribute name="Main-class" value="${ant.project.name}"/>
      </manifest>
    </jar>
  </target>

  <target name="run" depends="build">
    <java jar="${target}" fork="true"/>
  </target>
</project>

Thanks!

-----Original Message-----
From: Jan de Visser [mailto:jdevisser@digitalfairway.com]
Sent: Tuesday, July 13, 2004 1:17 PM
To: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] JDBC connection issue


On July 13, 2004 02:05 pm, Young Nam wrote:
> I've included both jar files in the CLASSPATH.  Same error.

But you still haven't shown us how you start your program...

JdV!!

--
--------------------------------------------------------------
Jan de Visser                     jdevisser@digitalfairway.com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Re: JDBC connection issue

From
Jan de Visser
Date:
n July 13, 2004 02:47 pm, you wrote:
> Hi,
>
> I changed CLASSPATH to
> /usr/local/pgsql/share/java/postgresql.jar:/home/youngnam/Developments/java
>_apps/xlang/src/Xlang.class (or Xlang.java, I tried both)

I would try

....../postgresql.jar:/home/youngnam/Developments/java_apps/xlang/src

(Has to be a directory or .jar).

>
> and then when i just compile and run
>
> >javac Xlang.java
> >java Xlang
>
> I get >Exception in thread "main"  java.lang.NoClassDefFoundError: Xlang

Couple of more things:
1. I am not your private java support engineer. It is considered *really* bad
form to directly address listmembers like you did.
2. Reading a java introduction may help you here.


>
> Thanks..

JdV!!

>
> -----Original Message-----
> From: Jan de Visser [mailto:jdevisser@digitalfairway.com]
> Sent: Tuesday, July 13, 2004 1:30 PM
> To: Young Nam
> Subject: Re: [JDBC] JDBC connection issue
>
> On July 13, 2004 02:20 pm, you wrote:
> > CLASSPATH is set to
> > /usr/local/pgsql/share/java/postgresql.jar:/home/youngnam/Development/jav
> >a_ apps/xlang/bin/Xlang.jar
> >
> > I am using ant to build the source files and create jar file.
> > In build.xml file, target that runs the program is,
> >
> > <target name="run" depends="build">
> >   <java jar="${target}" fork="true"/> where ${target} is bin/Xlang.jar
> > </target>
>
> ant does not use $CLASSPATH. Specify a nested <classpath> element. See the
> ant docs.
>
> > Thanks again,
> >
> > YJ
>
> JdV!!
>
> > -----Original Message-----
> > From: Kris Jurka [mailto:books@ejurka.com]
> > Sent: Tuesday, July 13, 2004 1:07 PM
> > To: Young Nam
> > Cc: pgsql-jdbc@postgresql.org
> > Subject: Re: [JDBC] JDBC connection issue
> >
> > On Tue, 13 Jul 2004, Young Nam wrote:
> > > Thanks for speedy replies, Kris.
> > >
> > > I've included both jar files in the CLASSPATH.  Same error.
> >
> > What exactly is the CLASSPATH and what exact command are you running java
> > with?
> >
> > Kris Jurka
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster

--
--------------------------------------------------------------
Jan de Visser                     jdevisser@digitalfairway.com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

Re: JDBC connection issue

From
"Young Nam"
Date:
Sorry to address everyone in the list with the java questions.  I am a newbie at Java and PostgreSQL who's trying to
resolvewhy the jdbc driver isn't working.  One question to another has led me here... 

I will try to address the list with more jdbc specific questions in the future.  Thank you for your replies.

best regards,

YJ

-----Original Message-----
From: Jan de Visser [mailto:jdevisser@digitalfairway.com]
Sent: Tuesday, July 13, 2004 2:01 PM
To: Young Nam; pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] JDBC connection issue


n July 13, 2004 02:47 pm, you wrote:
> Hi,
>
> I changed CLASSPATH to
> /usr/local/pgsql/share/java/postgresql.jar:/home/youngnam/Developments/java
>_apps/xlang/src/Xlang.class (or Xlang.java, I tried both)

I would try

....../postgresql.jar:/home/youngnam/Developments/java_apps/xlang/src

(Has to be a directory or .jar).

>
> and then when i just compile and run
>
> >javac Xlang.java
> >java Xlang
>
> I get >Exception in thread "main"  java.lang.NoClassDefFoundError: Xlang

Couple of more things:
1. I am not your private java support engineer. It is considered *really* bad
form to directly address listmembers like you did.
2. Reading a java introduction may help you here.


>
> Thanks..

JdV!!

>
> -----Original Message-----
> From: Jan de Visser [mailto:jdevisser@digitalfairway.com]
> Sent: Tuesday, July 13, 2004 1:30 PM
> To: Young Nam
> Subject: Re: [JDBC] JDBC connection issue
>
> On July 13, 2004 02:20 pm, you wrote:
> > CLASSPATH is set to
> > /usr/local/pgsql/share/java/postgresql.jar:/home/youngnam/Development/jav
> >a_ apps/xlang/bin/Xlang.jar
> >
> > I am using ant to build the source files and create jar file.
> > In build.xml file, target that runs the program is,
> >
> > <target name="run" depends="build">
> >   <java jar="${target}" fork="true"/> where ${target} is bin/Xlang.jar
> > </target>
>
> ant does not use $CLASSPATH. Specify a nested <classpath> element. See the
> ant docs.
>
> > Thanks again,
> >
> > YJ
>
> JdV!!
>
> > -----Original Message-----
> > From: Kris Jurka [mailto:books@ejurka.com]
> > Sent: Tuesday, July 13, 2004 1:07 PM
> > To: Young Nam
> > Cc: pgsql-jdbc@postgresql.org
> > Subject: Re: [JDBC] JDBC connection issue
> >
> > On Tue, 13 Jul 2004, Young Nam wrote:
> > > Thanks for speedy replies, Kris.
> > >
> > > I've included both jar files in the CLASSPATH.  Same error.
> >
> > What exactly is the CLASSPATH and what exact command are you running java
> > with?
> >
> > Kris Jurka
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster

--
--------------------------------------------------------------
Jan de Visser                     jdevisser@digitalfairway.com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------

Re: JDBC connection issue

From
Dave Cramer
Date:
When you run a java program using -jar jarfile, java will ignore the
CLASSPATH. This is why it can't find postgres.

Dave
On Tue, 2004-07-13 at 14:20, Young Nam wrote:
> CLASSPATH is set to
> /usr/local/pgsql/share/java/postgresql.jar:/home/youngnam/Development/java_apps/xlang/bin/Xlang.jar
>
> I am using ant to build the source files and create jar file.
> In build.xml file, target that runs the program is,
>
> <target name="run" depends="build">
>   <java jar="${target}" fork="true"/> where ${target} is bin/Xlang.jar
> </target>
>
> Thanks again,
>
> YJ
>
> -----Original Message-----
> From: Kris Jurka [mailto:books@ejurka.com]
> Sent: Tuesday, July 13, 2004 1:07 PM
> To: Young Nam
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] JDBC connection issue
>
>
>
>
> On Tue, 13 Jul 2004, Young Nam wrote:
>
> > Thanks for speedy replies, Kris.
> >
> > I've included both jar files in the CLASSPATH.  Same error.
> >
>
> What exactly is the CLASSPATH and what exact command are you running java
> with?
>
> Kris Jurka
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
>
> !DSPAM:40f428f2313221402172797!
>
>
--
Dave Cramer
519 939 0336
ICQ # 14675561


Re: JDBC connection issue

From
foredl@yahoo.com (datalines)
Date:
JDBC with anything...can be a real pain in the ass!!!!
why don't you learn to connect to the DB using PHP...there's
no drivers involved!   Also, the latest thing,
is using DBCP with Jakara Struts...why don't you read about that?
good luck
Ynam@sharedmarketing.com ("Young Nam") wrote in message
news:<581C48EBC132FF459E62A6809D0D72AE22C749@mail.sharedmarketing.com>...
> 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

Re: JDBC connection issue

From
Blaine Simpson
Date:
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


Re: JDBC connection issue

From
Kris Jurka
Date:

On Wed, 21 Jul 2004, Blaine Simpson wrote:

> 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.

"trust" has nothing to do with "ident" authentication, trust does not do
any authentication at all and just lets you in.  Using ident
authentication can be a little tricky with JDBC simply because it uses
tcp/ip to connect as opposed to unix sockets.  On the server side these
use different code paths for ident authentication with unix sockets
requiring kernel support for passing user information and tcp/ip sockets
requiring an ident server.

In any case the JDBC driver works fine with both trust and ident
authentication, as far as I know the only authentication method that are
unsupported by the JDBC driver is kerberos.

Kris Jurka

Re: JDBC connection issue

From
Blaine Simpson
Date:
Kris Jurka wrote:

>On Wed, 21 Jul 2004, Blaine Simpson wrote:
>
>
>
>>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.
>>
>>
>
>"trust" has nothing to do with "ident" authentication, trust does not do
>any authentication at all and just lets you in.  Using ident
>authentication can be a little tricky with JDBC simply because it uses
>tcp/ip to connect as opposed to unix sockets.  On the server side these
>use different code paths for ident authentication with unix sockets
>requiring kernel support for passing user information and tcp/ip sockets
>requiring an ident server.
>
>
Thanks for the correction.  I understand now that ident should work if
you can satisfy
the ident requirements.

I still stand by what I said about trust.  If you use TCP/IP, with or
without JDBC,
then if you use "trust" you  will have to deal with "... problems to do
with ident
deamons".   You just said that if you use "trust" with TCP/IP you need
an ident
server (due to differences in local vs. network socket handling in
server code).
Therefore, if you're running TCP/IP, "trust" has a lot to do with
"ident" authentication.
You don't need an ident server if you use "md5", you do need an ident
server if you
 use "trust".

>In any case the JDBC driver works fine with both trust and ident
>authentication, as far as I know the only authentication method that are
>unsupported by the JDBC driver is kerberos.
>
>Kris Jurka
>
>


--
ICF:  703-934-3692       Cell:  703-944-9317


Re: JDBC connection issue

From
Blaine Simpson
Date:
Oliver Jowett wrote:

> Blaine Simpson wrote:
>
>> Oliver Jowett wrote:
>>
>>> Blaine Simpson wrote:
>>>
>>>> You don't need an ident server if you use "md5", you do need an
>>>> ident server if you
>>>> use "trust".
>>>
>>>
>>>
>>>
>>> No. Please read
>>> http://www.postgresql.org/docs/7.4/static/auth-methods.html#AUTH-TRUST
>>
>>
>>
>> I did.  It says nothing about setting up trust for networks sockets,
>> implying that it is wide open.
>
>
> Are we reading the same document? The URL I provided explicitly talks
> about network sockets & trust auth. I quote:
>
> trust authentication is only suitable for TCP/IP connections if you
> trust every user on every machine that is allowed to connect to the
> server by the pg_hba.conf lines that specify trust. It is seldom
> reasonable to use trust for any TCP/IP connections other than those
> from localhost (127.0.0.1).

I have very good reading comprehension.  It says when TCP/IP suitable to
use, but says nothing
about what the requirements are.  As I said, that IMPLIES that there are
no additional requirements
and it is wide open.

The reason I question the implication is not that I can't read, but
because I have tried to use
psql (not JDBC) over tcpip sockets with "ident", and, what do you know,
just like Kris said,
there were system log messages about ident failures.  This is because
identd is disabled on
our servers and blocked by our firewalls.

>> But, as I've found in practice, and as Kris Jurka has pointed out,
>> you do have to satisfy ident
>> protocol requirements to use trust with network sockets.
>
>
> You are misquoting Kris. He said:
>
>>> "trust" has nothing to do with "ident" authentication, trust does
>>> not do
>>> any authentication at all and just lets you in.
>>
I know he said that, and I disagree with that because immediately after
he says that
"Using ident authentication can be tricky with JDBC" (you can't do
non-network socket
ident with JDBC according to everything I've read about using the JDBC
Driver) and
"On the server side... requiring  kernel support for passing user
infomation and tcp/ip sockets requiring an ident server.".  Yes, PG
server-side code
requires identd setup to use ident & tcp/ip.

> When trust auth is configured (for a particular source address), no
> ident query is done at all, so whether that source IP is running an
> ident server or not is irrelevant.
>
> -O



--
ICF:  703-934-3692       Cell:  703-944-9317


Re: JDBC connection issue

From
Oliver Jowett
Date:
Blaine Simpson wrote:
> Oliver Jowett wrote:
>
>> Blaine Simpson wrote:
>>
>>> Oliver Jowett wrote:
>>>
>>>> Blaine Simpson wrote:
>>>>
>>>>> You don't need an ident server if you use "md5", you do need an
>>>>> ident server if you
>>>>> use "trust".

To reiterate -- the second half of this statement is wrong.

> The reason I question the implication is not that I can't read, but
> because I have tried to use
> psql (not JDBC) over tcpip sockets with "ident", and, what do you know,
> just like Kris said,
> there were system log messages about ident failures.  This is because
> identd is disabled on
> our servers and blocked by our firewalls.

Sure -- to use ident authentication over TCP/IP, you need an ident
server. There's no disagreement there. But trust authentication is a
completely separate mechanism. It does not require an ident server.

To make sure I wasn't going crazy, I just doublechecked against the
7.4.1 server here. It does not make outgoing ident connections when
accepting connections from an IP that is configured for 'trust'.

>>> But, as I've found in practice, and as Kris Jurka has pointed out,
>>> you do have to satisfy ident
>>> protocol requirements to use trust with network sockets.

[... more about ident authentication needing an ident server ...]

I'm not disagreeing with you about ident authentication -- it's trust
authentication we're talking about.

-O