Обсуждение: Connection from win95 to postgresql using JDBC and jdk1.2

Поиск
Список
Период
Сортировка

Connection from win95 to postgresql using JDBC and jdk1.2

От
Doug Thistlethwaite
Дата:
Hello,

I know this subject is probably getting old on this list, but I have
still not been able to get my windows 95 system to connect to a linux
2.2.10 kernel system (debian potato) using jdk1.2 on a windows 95
system.  I am trying to get the examples working that came with the JDBC
drivers.   I have downloaded the latest JDBC2 driver from Peter Mount's
web site and I have gotten to the point where I get the following
message:


C:\jdk1.2\DSNBrowse>java example.basic jdbc:postgresql://dragon/doug
doug db
PostgreSQL basic test v6.3 rev 1

Starting constructor for basic
continueing constructor for basic
Connecting to Database URL = jdbc:postgresql://dragon/doug
Exception caught.
Something unusual has occured to cause the driver to fail. Please report
this
exception: java.sql.SQLException: Password authentication failed for
user 'doug'
Something unusual has occured to cause the driver to fail. Please report
this
exception: java.sql.SQLException: Password authentication failed for
user 'doug'       at postgresql.Driver.connect(Driver.java:112)       at java.sql.DriverManager.getConnection(Compiled
Code)      at java.sql.DriverManager.getConnection(DriverManager.java:137)       at example.basic.<init>(basic.java:34)
     at example.basic.main(basic.java:168)
 

The linux system is connect to the windows 95 system via a small
network.

I have modified the pg_hba.conf file to allow for connections from my PC
using the line

host         doug        207.155.49.102 255.255.255.255  password
/var/postgres/passwd

I tested the connection by using this command on the linux system:

psql -u -h localhost doug

and logged in with the same user name and password I am trying to use on
the PC.  The above psql connection works fine.

Can someone point me in the correct direction on what to look for?  I
think I am pretty close, but I have not been able to get any further in
the last week.

Thank you for your time.

Doug Thistlethwaite




Re: [INTERFACES] Connection from win95 to postgresql using JDBC and jdk1.2

От
Peter Mount
Дата:
On Fri, 23 Jul 1999, Doug Thistlethwaite wrote:

[snip]
> host         doug        207.155.49.102 255.255.255.255  password
> /var/postgres/passwd

Try it without anything after the password keyword, ie

host doug 207.155.49.102 255.255.255.255 password


--      Peter T Mount peter@retep.org.uk     Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf



Re: [INTERFACES] Connection from win95 to postgresql using JDBC andjdk1.2

От
Doug Thistlethwaite
Дата:
Peter, <p>Glad you have your system back up and running! :) <p>I have already tried this and I received the same
resultsas I did without the line (Auth failure). <p>Your previous message stated that: <blockquote type="CITE"><pre>I'm
nowused to the more recent backends, which use the "ALTER USER" sql
 
statement, and the passwords are now stored in a hidden system table,
which is why my examples above don't have a file name in them.</pre></blockquote><p><br />How do I load my original
passwordsinto this hidden system file?  I added the password for doug using the following command: <p>pg_passwd
/var/postgres/passwd<p><Enter User Name> Doug <br /><Enter User Password> db <p>I did not see anything in
thedocs about setting passwords into the system table.  Is there a different way to enter passwords now for postgres
access? The system password for user 'doug' is not 'db' like I set it in the pg_passwd command. <p>Thanks, <p>Doug
<p>PeterMount wrote: <blockquote type="CITE">On Fri, 23 Jul 1999, Doug Thistlethwaite wrote: <p>[snip] <br />>
host        doug        207.155.49.102 255.255.255.255  password <br />> /var/postgres/passwd <p>Try it without
anythingafter the password keyword, ie <p>host doug 207.155.49.102 255.255.255.255 password <p>-- <br />       Peter T
Mountpeter@retep.org.uk <br />      Main Homepage: <a href="http://www.retep.org.uk">http://www.retep.org.uk</a><br
/>PostgreSQLJDBC Faq: <a href="http://www.retep.org.uk/postgres">http://www.retep.org.uk/postgres</a><br /> Java PDF
Generator:<a href="http://www.retep.org.uk/pdf">http://www.retep.org.uk/pdf</a></blockquote> 

Re: [INTERFACES] Connection from win95 to postgresql using JDBC andjdk1.2

От
Peter Mount
Дата:
On Fri, 23 Jul 1999, Doug Thistlethwaite wrote:

> Peter,
> 
> Glad you have your system back up and running! :)
> 
> I have already tried this and I received the same results as I did
> without the line (Auth failure).
> 
> Your previous message stated that:
> 
> > I'm now used to the more recent backends, which use the "ALTER USER" sql
> > statement, and the passwords are now stored in a hidden system table,
> > which is why my examples above don't have a file name in them.
> >
> 
> How do I load my original passwords into this hidden system file?  I
> added the password for doug using the following command:
> 
> pg_passwd /var/postgres/passwd
> 
> <Enter User Name> Doug
> <Enter User Password> db
> 
> I did not see anything in the docs about setting passwords into the
> system table.  Is there a different way to enter passwords now for
> postgres access?

Yes.

There's a hidden table called pg_shadow which contains the user names and
passwords, and a view called pg_user which lists the same thing (with *
replacing the password entries).

The ALTER USER statement updates pg_shadow, which then updates a flatfile
in the PGDATA directory (someone correct me if I'm wrong here, I'm pulling
this from memory), which is then used by the postmaster when the
connections are made.

This flat file is why ALTER USER should be used, not an UPDATE statement
on the pg_shadow table.

Peter

--      Peter T Mount peter@retep.org.uk     Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgresJava PDF Generator: http://www.retep.org.uk/pdf



Re: [INTERFACES] Connection from win95 to postgresql using JDBC andjdk1.2

От
Doug Thistlethwaite
Дата:
Peter,

Ok, I looked and there was a table pg_user.  I notice it is in the template and
my database.  I modified it using the command (in psql)
ALTER USER doug with PASSWORD FRED;
This seems to have worked and the command returned ALTER USER.

Ok I removed the file name in the pg_hba.conf file and restarted postgres.

I get the same message when I try to connect from Java on the PC! :(

As a test, I tried this command from the linux shell

psql -u -h localhost doug

Username: doug
password: fred

Everything seems to work fine.

I also tried the same command with a bogus password and it also worked! so the
above statement must not be checking passwords or something.

I am totally lost on what to do.

Doug


Peter Mount wrote:

> On Fri, 23 Jul 1999, Doug Thistlethwaite wrote:
>
> > Peter,
> >
> > Glad you have your system back up and running! :)
> >
> > I have already tried this and I received the same results as I did
> > without the line (Auth failure).
> >
> > Your previous message stated that:
> >
> > > I'm now used to the more recent backends, which use the "ALTER USER" sql
> > > statement, and the passwords are now stored in a hidden system table,
> > > which is why my examples above don't have a file name in them.
> > >
> >
> > How do I load my original passwords into this hidden system file?  I
> > added the password for doug using the following command:
> >
> > pg_passwd /var/postgres/passwd
> >
> > <Enter User Name> Doug
> > <Enter User Password> db
> >
> > I did not see anything in the docs about setting passwords into the
> > system table.  Is there a different way to enter passwords now for
> > postgres access?
>
> Yes.
>
> There's a hidden table called pg_shadow which contains the user names and
> passwords, and a view called pg_user which lists the same thing (with *
> replacing the password entries).
>
> The ALTER USER statement updates pg_shadow, which then updates a flatfile
> in the PGDATA directory (someone correct me if I'm wrong here, I'm pulling
> this from memory), which is then used by the postmaster when the
> connections are made.
>
> This flat file is why ALTER USER should be used, not an UPDATE statement
> on the pg_shadow table.
>
> Peter
>
> --
>        Peter T Mount peter@retep.org.uk
>       Main Homepage: http://www.retep.org.uk
> PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
>  Java PDF Generator: http://www.retep.org.uk/pdf