Re: [JDBC] newbie: retep wants to have username?

2001-02-16 Thread Mirko Zeibig

On Fri, Feb 16, 2001 at 11:11:58AM -0500, Peter T Mount wrote:
> Quoting Mirko Zeibig <[EMAIL PROTECTED]>:
> > 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
>

Thanks a lot! Now I get a connect to the database, but XMLExport is
choking with an error:

[mirko@romulan jars]$ java -cp ./retepTools.jar \
uk.org.retep.xml.test.XMLExport -Dorg.postgresql.Driver \
-J"jdbc:postgresql:mirko?user=mirko&password=X" -S 
Now using JDBC Driver: org.postgresql.Driver
Opened jdbc:postgresql:mirko?user=mirko&password=X
Generating XML Schema of database
java.lang.NullPointerException
at
org.postgresql.jdbc2.DatabaseMetaData.getTables(DatabaseMetaData.java:1707)
at
uk.org.retep.xml.jdbc.XMLDatabase.writeDatabase(XMLDatabase.java:222)
at
uk.org.retep.xml.jdbc.XMLDatabase.writeDatabase(XMLDatabase.java:188)
at uk.org.retep.xml.test.XMLExport.(XMLExport.java:83)
at uk.org.retep.xml.test.XMLExport.main(XMLExport.java:186)
[mirko@romulan jars]$ 

If you need more information I am happy to send a more complete transcript
with -verbose enabled.


> > 
> > I studied the jdbc-interface documentation and did not see this syntax
> > mentioned anywhere.
> 
> Doesn't exist ;-)

Maybe this syntax should be documented anywhere? I knew about 1: but have
not seen 2: or 3: :-).

Best Regards
Mirko
-- 
[EMAIL PROTECTED]
http://sites.inka.de/picard/



Re: [JDBC] newbie: retep wants to have username?

2001-02-16 Thread Peter T Mount

Quoting Mirko Zeibig <[EMAIL PROTECTED]>:

> 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 [EMAIL PROTECTED]
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/



[JDBC] newbie: retep wants to have username?

2001-02-16 Thread Mirko Zeibig

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.
at java.lang.Throwable.(Throwable.java:84)
at java.lang.Exception.(Exception.java:35)
at java.sql.SQLException.(SQLException.java:100)
at org.postgresql.util.PSQLException.(PSQLException.java:23)
at org.postgresql.Connection.openConnection(Connection.java:115)
at org.postgresql.Driver.connect(Driver.java:118)
at java.sql.DriverManager.getConnection(DriverManager.java:523)
at java.sql.DriverManager.getConnection(DriverManager.java:205)
at uk.org.retep.xml.test.XMLExport.(XMLExport.java:55)
at uk.org.retep.xml.test.XMLExport.main(XMLExport.java:186)
[mirko@romulan jars]$ 

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

I tried jdbc:postgresql:mirko/mirko@localhost for -J as well, same 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.

Best Regards
Mirko
-- 
[EMAIL PROTECTED]
http://sites.inka.de/picard/