Re: newbie: retep wants to have username? - Mailing list pgsql-jdbc

From Peter T Mount
Subject Re: newbie: retep wants to have username?
Date
Msg-id 982339918.3a8d514ea07e0@webmail.retep.org.uk
Whole thread Raw
In response to newbie: retep wants to have username?  (Mirko Zeibig <mirko@picard.inka.de>)
Responses Re: newbie: retep wants to have username?
List pgsql-jdbc
Quoting Mirko Zeibig <mirko@picard.inka.de>:

> Hello everybody,
>
> I am not that deep in Java, just playing a bit with it, using PG7.1beta
> from
> CVS on RedHat 7.0. Going to contrib/retep/jars I tried:
>
> [mirko@romulan jars]$ java -cp ./retepTools.jar \
> uk.org.retep.xml.test.XMLExport \
> -Dorg.postgresql.Driver \
> -Jjdbc:postgresql:mirko/mirko
> Now using JDBC Driver: org.postgresql.Driver
> The user property is missing. It is mandatory.

Yes, its asking for the postgresql username.

There's three ways of supplying it.

1: use: .getConnection(url,user,password);
2: use: .getConnection(url) with user/password in the url
3: use: .getConnection(url,props) where props is a Properties with the
user/password in it.

for 2 use: jdbc:postgresql:db?user=PETER&password=SECRET

for 3 have properties called user & password

(internally the driver converts them into Properties anyhow ;-) )

> to get a dump of the database. It is a bit of a pity that examples
> exposed when invoked without parameters are all about oracle :-).

Oracle can be a bit lax with security at times ;-)

> I tried jdbc:postgresql:mirko/mirko@localhost for -J as well, same

Nope. There is no actual url standard (other than jdbc:subprotocol:).

Try: jdbc:postgresql:mirko?user=mirko (localhost is optional or)
     jdbc:postgresql://localhost/mirko?user=mirko

> result. I
> do not see where the jdbc-url is parsed, I guess somewhere in the
> pgsql-driver? Is it possible to use a url with user/db@host with
> PostgreSQL
> at all?
>
> I studied the jdbc-interface documentation and did not see this syntax
> mentioned anywhere.

Doesn't exist ;-)

Peter

--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/

pgsql-jdbc by date:

Previous
From: Mirko Zeibig
Date:
Subject: newbie: retep wants to have username?
Next
From: Bob Kline
Date:
Subject: Re: Trouble With JDBC