Обсуждение: Sorry, I forgot put the exception in my message...

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

Sorry, I forgot put the exception in my message...

От
Javier Benito
Дата:
Well, my problem isn't with the JDBC driver. I still haven't learnt to
use it. I'm doing now. The initial exception, when i was trying to
connect in such a way:

                String url = "jdbc:postgresql:BDPrueba";

                Connection con = DriverManager.getConnection(url,"","");

was:

Connection refused. Check that the hostname and port is correct, and
that the po
stmaster is running with the -i flag, which enables TCP/IP networking.
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Compiled Code)
        at java.sql.SQLException.<init>(Compiled Code)
        at postgresql.util.PSQLException.<init>(Compiled Code)
        at postgresql.Connection.openConnection(Compiled Code)
        at postgresql.Driver.connect(Compiled Code)
        at java.sql.DriverManager.getConnection(Compiled Code)
        at java.sql.DriverManager.getConnection(Compiled Code)
        at prueba.main(Compiled Code)

and when I'm trying to connect in this way:

               String url = "jdbc:postgresql:BDPrueba";

            Connection con = DriverManager.getConnection(url,"","");

my problem is:

Unknown object of type:java.lang.NullPointerException
java.lang.IllegalArgumentException: Unknown argument
        at java.lang.Throwable.<init>(Compiled Code)
        at java.lang.Exception.<init>(Compiled Code)
        at java.lang.RuntimeException.<init>(Compiled Code)
        at java.lang.IllegalArgumentException.<init>(Compiled Code)
        at java.text.MessageFormat.format(Compiled Code)
        at java.text.MessageFormat.format(Compiled Code)
        at java.text.MessageFormat.format(Compiled Code)
        at postgresql.util.PSQLException.translate(Compiled Code)
        at postgresql.util.PSQLException.<init>(Compiled Code)
        at postgresql.Driver.connect(Compiled Code)
        at java.sql.DriverManager.getConnection(Compiled Code)
        at java.sql.DriverManager.getConnection(Compiled Code)
        at prueba.main(Compiled Code)

I've checked that postmaster is running in Solaris 5.6 with -i option. I
think the problem may be that i'm not defining users, but in the
pg_hba.conf file the defaults are that anyone in anywhere can connects
to any database.
What can i do?

Thanks for thinking a little time in this question.
Javi.

Вложения

Re: Sorry, I forgot put the exception in my message...

От
Tom Cook
Дата:
On Wed, 19 Apr 2000, Javier Benito wrote:

> I've checked that postmaster is running in Solaris 5.6 with -i option. I
> think the problem may be that i'm not defining users, but in the
> pg_hba.conf file the defaults are that anyone in anywhere can connects
> to any database.
> What can i do?

After some playing around, it seems to me that you do need to connect as
some user. Creating a user is not a strenuous process if you're a DBA; if
not, you need to discover a correct username and password. I can't connect
via _any_ method without a username and password ('psql -u db_name' says
'No postgres username specified in startup packet.' if I don't give it a
username). So I'd try this.

Cheers
--
Tom Cook - Software Engineer

"Christ died for sin, the righteous for the unrighteous, to bring you to God."
    - 1 Peter 3:18

LISAcorp - www.lisa.com.au

--------------------------------------------------
38 Greenhill Rd.          Level 3, 228 Pitt Street
Wayville, SA, 5034        Sydney, NSW, 2000

Phone:   +61 8 8272 1555  Phone:   +61 2 9283 0877
Fax:     +61 8 8271 1199  Fax:     +61 2 9283 0866
--------------------------------------------------