Thread: forName finds Driver but getConnection doesn't

forName finds Driver but getConnection doesn't

From
Dennis King
Date:
Hi All. I can't get to my carefully set-up database through java with
a simple test program. I think I've hit most of the required set-up
points:

* I've got all the postgresql packages installed (checked with rpm
-qa | grep -i postgres; they're there, including the jdbc one).
* I set tcpip_socket = true in /var/lib/pgsql/data/postgresql.conf.
* I also updated /etc/rc.d/init.d/ so that postmaster gets -o "-i";
this means that the "pg_ctl -D /var/lib/pgsql/data status" command
shows the -i flag was passed in.
* I have the right driver in the classpath (I pass in -classpath
/usr/share/pgsql/pgjdbc2.jar when compiling and running; for some
reason, copying the jar to /jre/lib/ext doesn't work with any jars
for me).
* I added the lines "host all 127.0.0.1 255.255.255.255 trust" and
"host all 192.168.0.0 255.255.0.0 trust" to
/var/lib/pgsql/data/pg_hba.conf
* I created a new database, "webdb"
* I added the user "xxx" with the password "yyy" to the database, and
verified by logging into psql with -U xxx (had pg_hba.conf set to
password so was challenged and succeeded)

With all of this, my java program has these lines:

Connection dbConnection = null;
try{
Class.forName("org.postgresql.Driver");
dbConnection = DriverManager.getConnection("jdbc:postgresql:webdb",
"xxx", "yyy");
}

I get the error "java.sql.SQLException: Driver not found for URL:
jdbc:postgresql:webdb". (Note it's finding the driver with the
forName() method call).

I've tried using jdbc:postgresql://localhost/webdb.

I have, of course, restarted the box several times.

Any pointers you have would be extremely gratefully received.

Best,

Dennis

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: forName finds Driver but getConnection doesn't

From
Haris Peco
Date:
On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> Hi All. I can't get to my carefully set-up database through java with
> a simple test program. I think I've hit most of the required set-up
> points:
>
> * I've got all the postgresql packages installed (checked with rpm
> -qa | grep -i postgres; they're there, including the jdbc one).
> * I set tcpip_socket = true in /var/lib/pgsql/data/postgresql.conf.
> * I also updated /etc/rc.d/init.d/ so that postmaster gets -o "-i";
> this means that the "pg_ctl -D /var/lib/pgsql/data status" command
> shows the -i flag was passed in.
> * I have the right driver in the classpath (I pass in -classpath
> /usr/share/pgsql/pgjdbc2.jar when compiling and running; for some
> reason, copying the jar to /jre/lib/ext doesn't work with any jars
> for me).
> * I added the lines "host all 127.0.0.1 255.255.255.255 trust" and
> "host all 192.168.0.0 255.255.0.0 trust" to
> /var/lib/pgsql/data/pg_hba.conf
> * I created a new database, "webdb"
> * I added the user "xxx" with the password "yyy" to the database, and
> verified by logging into psql with -U xxx (had pg_hba.conf set to
> password so was challenged and succeeded)
>
> With all of this, my java program has these lines:
>
> Connection dbConnection = null;
> try{
> Class.forName("org.postgresql.Driver");
> dbConnection = DriverManager.getConnection("jdbc:postgresql:webdb",
> "xxx", "yyy");
> }
>
> I get the error "java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql:webdb". (Note it's finding the driver with the
> forName() method call).
>
> I've tried using jdbc:postgresql://localhost/webdb.
>
> I have, of course, restarted the box several times.
>
> Any pointers you have would be extremely gratefully received.
>
Hello Dennis,
  jdbc:postgresql:webdb is not good URL
If you database webdb and server localhost then second URL is good
and problem is in TCP connection - what is your port ?

regards
Haris Peco

Re: forName finds Driver but getConnection doesn't

From
Dennis King
Date:
--- Haris Peco <snpe@snpe.co.yu> wrote:
> On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > Hi All. I can't get to my carefully set-up database through java
> with
> > a simple test program. I think I've hit most of the required
> set-up
> > points:
> >
> > * I've got all the postgresql packages installed (checked with
> rpm
> > -qa | grep -i postgres; they're there, including the jdbc one).
> > * I set tcpip_socket = true in
> /var/lib/pgsql/data/postgresql.conf.
> > * I also updated /etc/rc.d/init.d/ so that postmaster gets -o
> "-i";
> > this means that the "pg_ctl -D /var/lib/pgsql/data status"
> command
> > shows the -i flag was passed in.
> > * I have the right driver in the classpath (I pass in -classpath
> > /usr/share/pgsql/pgjdbc2.jar when compiling and running; for some
> > reason, copying the jar to /jre/lib/ext doesn't work with any
> jars
> > for me).
> > * I added the lines "host all 127.0.0.1 255.255.255.255 trust"
> and
> > "host all 192.168.0.0 255.255.0.0 trust" to
> > /var/lib/pgsql/data/pg_hba.conf
> > * I created a new database, "webdb"
> > * I added the user "xxx" with the password "yyy" to the database,
> and
> > verified by logging into psql with -U xxx (had pg_hba.conf set to
> > password so was challenged and succeeded)
> >
> > With all of this, my java program has these lines:
> >
> > Connection dbConnection = null;
> > try{
> > Class.forName("org.postgresql.Driver");
> > dbConnection =
> DriverManager.getConnection("jdbc:postgresql:webdb",
> > "xxx", "yyy");
> > }
> >
> > I get the error "java.sql.SQLException: Driver not found for URL:
> > jdbc:postgresql:webdb". (Note it's finding the driver with the
> > forName() method call).
> >
> > I've tried using jdbc:postgresql://localhost/webdb.
> >
> > I have, of course, restarted the box several times.
> >
> > Any pointers you have would be extremely gratefully received.
> >
> Hello Dennis,
>   jdbc:postgresql:webdb is not good URL
> If you database webdb and server localhost then second URL is good
> and problem is in TCP connection - what is your port ?
>
> regards
> Haris Peco

Haris et al.,

I never specified a port in the install, so Postgresql should be
running on the default port, 5432. I did uncomment the line in the
.conf file (all lines seem to be commmented out by default). (By the
way, my .conf file has all lines commented out, which I presume means
that it's just operating on the defaults. Is there any chance my
firewall (default product shipped with Red Hat 8) would be
interfering with the communication?

Just in case it helps, the SQLException stack trace is this:

java.sql.SQLException: Driver not found for URL:
jdbc:postgresql://localhost:webdb
   at 0x4028115f: java.lang.Throwable.Throwable(java.lang.String)
(/usr/lib/libgcj.so.3)
   at 0x402740d2: java.lang.Exception.Exception(java.lang.String)
(/usr/lib/libgcj.so.3)
   at 0x40316294:
java.sql.SQLException.SQLException(java.lang.String,
java.lang.String, int) (/usr/lib/libgcj.so.3)
   at 0x40316244:
java.sql.SQLException.SQLException(java.lang.String)
(/usr/lib/libgcj.so.3)
   at 0x40316102:
java.sql.DriverManager.getConnection(java.lang.String,
java.util.Properties) (/usr/lib/libgcj.so.3)
   at 0x4031603a:
java.sql.DriverManager.getConnection(java.lang.String,
java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
   at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
   at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
   at 0x40248528:
_Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
(/usr/lib/libgcj.so.3)
   at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
   at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
void) (/usr/lib/libgcj.so.3)
   at 0x4039d1bc: ?? (??:0)
   at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
(/usr/lib/libgcj.so.3)   at 0x402c60b1:
gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
   at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
(/usr/lib/libgcj.so.3)
   at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte
const, boolean) (/usr/lib/libgcj.so.3)
   at 0x08048900: __gcj_personality_v0
(jdbc.driver=org.postgresql.Driver)
   at 0x420158d4: __libc_start_main
(jdbc.driver=org.postgresql.Driver)
   at 0x080486c1: _Jv_RegisterClasses
(jdbc.driver=org.postgresql.Driver)
java.sql.SQLException: Driver not found for URL:
jdbc:postgresql://localhost:webdb


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: forName finds Driver but getConnection doesn't

From
Haris Peco
Date:
On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> --- Haris Peco <snpe@snpe.co.yu> wrote:
> > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > Hi All. I can't get to my carefully set-up database through java
> >
> > with
> >
> > > a simple test program. I think I've hit most of the required
> >
> > set-up
> >
> > > points:
> > >
> > > * I've got all the postgresql packages installed (checked with
> >
> > rpm
> >
> > > -qa | grep -i postgres; they're there, including the jdbc one).
> > > * I set tcpip_socket = true in
> >
> > /var/lib/pgsql/data/postgresql.conf.
> >
> > > * I also updated /etc/rc.d/init.d/ so that postmaster gets -o
> >
> > "-i";
> >
> > > this means that the "pg_ctl -D /var/lib/pgsql/data status"
> >
> > command
> >
> > > shows the -i flag was passed in.
> > > * I have the right driver in the classpath (I pass in -classpath
> > > /usr/share/pgsql/pgjdbc2.jar when compiling and running; for some
> > > reason, copying the jar to /jre/lib/ext doesn't work with any
> >
> > jars
> >
> > > for me).
> > > * I added the lines "host all 127.0.0.1 255.255.255.255 trust"
> >
> > and
> >
> > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > /var/lib/pgsql/data/pg_hba.conf
> > > * I created a new database, "webdb"
> > > * I added the user "xxx" with the password "yyy" to the database,
> >
> > and
> >
> > > verified by logging into psql with -U xxx (had pg_hba.conf set to
> > > password so was challenged and succeeded)
> > >
> > > With all of this, my java program has these lines:
> > >
> > > Connection dbConnection = null;
> > > try{
> > > Class.forName("org.postgresql.Driver");
> > > dbConnection =
> >
> > DriverManager.getConnection("jdbc:postgresql:webdb",
> >
> > > "xxx", "yyy");
> > > }
> > >
> > > I get the error "java.sql.SQLException: Driver not found for URL:
> > > jdbc:postgresql:webdb". (Note it's finding the driver with the
> > > forName() method call).
> > >
> > > I've tried using jdbc:postgresql://localhost/webdb.
> > >
> > > I have, of course, restarted the box several times.
> > >
> > > Any pointers you have would be extremely gratefully received.
> >
> > Hello Dennis,
> >   jdbc:postgresql:webdb is not good URL
> > If you database webdb and server localhost then second URL is good
> > and problem is in TCP connection - what is your port ?
> >
> > regards
> > Haris Peco
>
> Haris et al.,
>
> I never specified a port in the install, so Postgresql should be
> running on the default port, 5432. I did uncomment the line in the
> .conf file (all lines seem to be commmented out by default). (By the
> way, my .conf file has all lines commented out, which I presume means
> that it's just operating on the defaults. Is there any chance my
> firewall (default product shipped with Red Hat 8) would be
> interfering with the communication?
>
> Just in case it helps, the SQLException stack trace is this:
>
> java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql://localhost:webdb
>    at 0x4028115f: java.lang.Throwable.Throwable(java.lang.String)
> (/usr/lib/libgcj.so.3)
>    at 0x402740d2: java.lang.Exception.Exception(java.lang.String)
> (/usr/lib/libgcj.so.3)
>    at 0x40316294:
> java.sql.SQLException.SQLException(java.lang.String,
> java.lang.String, int) (/usr/lib/libgcj.so.3)
>    at 0x40316244:
> java.sql.SQLException.SQLException(java.lang.String)
> (/usr/lib/libgcj.so.3)
>    at 0x40316102:
> java.sql.DriverManager.getConnection(java.lang.String,
> java.util.Properties) (/usr/lib/libgcj.so.3)
>    at 0x4031603a:
> java.sql.DriverManager.getConnection(java.lang.String,
> java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
>    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
>    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
>    at 0x40248528:
> _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> (/usr/lib/libgcj.so.3)
>    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
> _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
>    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void, ffi_raw,
> void) (/usr/lib/libgcj.so.3)
>    at 0x4039d1bc: ?? (??:0)
>    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> (/usr/lib/libgcj.so.3)   at 0x402c60b1:
> gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
>    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
> (/usr/lib/libgcj.so.3)
>    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int, byte
> const, boolean) (/usr/lib/libgcj.so.3)
>    at 0x08048900: __gcj_personality_v0
> (jdbc.driver=org.postgresql.Driver)
>    at 0x420158d4: __libc_start_main
> (jdbc.driver=org.postgresql.Driver)
>    at 0x080486c1: _Jv_RegisterClasses
> (jdbc.driver=org.postgresql.Driver)
> java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql://localhost:webdb
>
>
Is it postgresl.jar in CLASSPATH ?

Re: forName finds Driver but getConnection doesn't

From
Dennis King
Date:
I run my program with

java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
-Djdbc.drivers=org.postgresql.Driver MyProgram

By the way, I had a temporary typo in the sourceURL that shows up in
the stack trace (jdbc:postgres://host:database instead of
host/database) but that was only temporary.


--- Haris Peco <snpe@snpe.co.yu> wrote:
> On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > > Hi All. I can't get to my carefully set-up database through
> java
> > >
> > > with
> > >
> > > > a simple test program. I think I've hit most of the required
> > >
> > > set-up
> > >
> > > > points:
> > > >
> > > > * I've got all the postgresql packages installed (checked
> with
> > >
> > > rpm
> > >
> > > > -qa | grep -i postgres; they're there, including the jdbc
> one).
> > > > * I set tcpip_socket = true in
> > >
> > > /var/lib/pgsql/data/postgresql.conf.
> > >
> > > > * I also updated /etc/rc.d/init.d/ so that postmaster gets -o
> > >
> > > "-i";
> > >
> > > > this means that the "pg_ctl -D /var/lib/pgsql/data status"
> > >
> > > command
> > >
> > > > shows the -i flag was passed in.
> > > > * I have the right driver in the classpath (I pass in
> -classpath
> > > > /usr/share/pgsql/pgjdbc2.jar when compiling and running; for
> some
> > > > reason, copying the jar to /jre/lib/ext doesn't work with any
> > >
> > > jars
> > >
> > > > for me).
> > > > * I added the lines "host all 127.0.0.1 255.255.255.255
> trust"
> > >
> > > and
> > >
> > > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > > /var/lib/pgsql/data/pg_hba.conf
> > > > * I created a new database, "webdb"
> > > > * I added the user "xxx" with the password "yyy" to the
> database,
> > >
> > > and
> > >
> > > > verified by logging into psql with -U xxx (had pg_hba.conf
> set to
> > > > password so was challenged and succeeded)
> > > >
> > > > With all of this, my java program has these lines:
> > > >
> > > > Connection dbConnection = null;
> > > > try{
> > > > Class.forName("org.postgresql.Driver");
> > > > dbConnection =
> > >
> > > DriverManager.getConnection("jdbc:postgresql:webdb",
> > >
> > > > "xxx", "yyy");
> > > > }
> > > >
> > > > I get the error "java.sql.SQLException: Driver not found for
> URL:
> > > > jdbc:postgresql:webdb". (Note it's finding the driver with
> the
> > > > forName() method call).
> > > >
> > > > I've tried using jdbc:postgresql://localhost/webdb.
> > > >
> > > > I have, of course, restarted the box several times.
> > > >
> > > > Any pointers you have would be extremely gratefully received.
> > >
> > > Hello Dennis,
> > >   jdbc:postgresql:webdb is not good URL
> > > If you database webdb and server localhost then second URL is
> good
> > > and problem is in TCP connection - what is your port ?
> > >
> > > regards
> > > Haris Peco
> >
> > Haris et al.,
> >
> > I never specified a port in the install, so Postgresql should be
> > running on the default port, 5432. I did uncomment the line in
> the
> > .conf file (all lines seem to be commmented out by default). (By
> the
> > way, my .conf file has all lines commented out, which I presume
> means
> > that it's just operating on the defaults. Is there any chance my
> > firewall (default product shipped with Red Hat 8) would be
> > interfering with the communication?
> >
> > Just in case it helps, the SQLException stack trace is this:
> >
> > java.sql.SQLException: Driver not found for URL:
> > jdbc:postgresql://localhost:webdb
> >    at 0x4028115f: java.lang.Throwable.Throwable(java.lang.String)
> > (/usr/lib/libgcj.so.3)
> >    at 0x402740d2: java.lang.Exception.Exception(java.lang.String)
> > (/usr/lib/libgcj.so.3)
> >    at 0x40316294:
> > java.sql.SQLException.SQLException(java.lang.String,
> > java.lang.String, int) (/usr/lib/libgcj.so.3)
> >    at 0x40316244:
> > java.sql.SQLException.SQLException(java.lang.String)
> > (/usr/lib/libgcj.so.3)
> >    at 0x40316102:
> > java.sql.DriverManager.getConnection(java.lang.String,
> > java.util.Properties) (/usr/lib/libgcj.so.3)
> >    at 0x4031603a:
> > java.sql.DriverManager.getConnection(java.lang.String,
> > java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
> >    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
> >    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
> >    at 0x40248528:
> > _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> > (/usr/lib/libgcj.so.3)
> >    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
> > _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
> >    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void,
> ffi_raw,
> > void) (/usr/lib/libgcj.so.3)
> >    at 0x4039d1bc: ?? (??:0)
> >    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> > (/usr/lib/libgcj.so.3)   at 0x402c60b1:
> > gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
> >    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
> > (/usr/lib/libgcj.so.3)
> >    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int,
> byte
> > const, boolean) (/usr/lib/libgcj.so.3)
> >    at 0x08048900: __gcj_personality_v0
> > (jdbc.driver=org.postgresql.Driver)
> >    at 0x420158d4: __libc_start_main
> > (jdbc.driver=org.postgresql.Driver)
> >    at 0x080486c1: _Jv_RegisterClasses
> > (jdbc.driver=org.postgresql.Driver)
> > java.sql.SQLException: Driver not found for URL:
> > jdbc:postgresql://localhost:webdb
> >
> >
> Is it postgresl.jar in CLASSPATH ?


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: forName finds Driver but getConnection doesn't

From
Haris Peco
Date:
Can you log in Postgresql with :
psql -h localhost -U xxx -p 5432 -d webdb ?

On Wednesday 20 November 2002 04:57 pm, Dennis King wrote:
> I run my program with
>
> java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
> -Djdbc.drivers=org.postgresql.Driver MyProgram
>
> By the way, I had a temporary typo in the sourceURL that shows up in
> the stack trace (jdbc:postgres://host:database instead of
> host/database) but that was only temporary.
>
> --- Haris Peco <snpe@snpe.co.yu> wrote:
> > On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > > > Hi All. I can't get to my carefully set-up database through
> >
> > java
> >
> > > > with
> > > >
> > > > > a simple test program. I think I've hit most of the required
> > > >
> > > > set-up
> > > >
> > > > > points:
> > > > >
> > > > > * I've got all the postgresql packages installed (checked
> >
> > with
> >
> > > > rpm
> > > >
> > > > > -qa | grep -i postgres; they're there, including the jdbc
> >
> > one).
> >
> > > > > * I set tcpip_socket = true in
> > > >
> > > > /var/lib/pgsql/data/postgresql.conf.
> > > >
> > > > > * I also updated /etc/rc.d/init.d/ so that postmaster gets -o
> > > >
> > > > "-i";
> > > >
> > > > > this means that the "pg_ctl -D /var/lib/pgsql/data status"
> > > >
> > > > command
> > > >
> > > > > shows the -i flag was passed in.
> > > > > * I have the right driver in the classpath (I pass in
> >
> > -classpath
> >
> > > > > /usr/share/pgsql/pgjdbc2.jar when compiling and running; for
> >
> > some
> >
> > > > > reason, copying the jar to /jre/lib/ext doesn't work with any
> > > >
> > > > jars
> > > >
> > > > > for me).
> > > > > * I added the lines "host all 127.0.0.1 255.255.255.255
> >
> > trust"
> >
> > > > and
> > > >
> > > > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > > > /var/lib/pgsql/data/pg_hba.conf
> > > > > * I created a new database, "webdb"
> > > > > * I added the user "xxx" with the password "yyy" to the
> >
> > database,
> >
> > > > and
> > > >
> > > > > verified by logging into psql with -U xxx (had pg_hba.conf
> >
> > set to
> >
> > > > > password so was challenged and succeeded)
> > > > >
> > > > > With all of this, my java program has these lines:
> > > > >
> > > > > Connection dbConnection = null;
> > > > > try{
> > > > > Class.forName("org.postgresql.Driver");
> > > > > dbConnection =
> > > >
> > > > DriverManager.getConnection("jdbc:postgresql:webdb",
> > > >
> > > > > "xxx", "yyy");
> > > > > }
> > > > >
> > > > > I get the error "java.sql.SQLException: Driver not found for
> >
> > URL:
> > > > > jdbc:postgresql:webdb". (Note it's finding the driver with
> >
> > the
> >
> > > > > forName() method call).
> > > > >
> > > > > I've tried using jdbc:postgresql://localhost/webdb.
> > > > >
> > > > > I have, of course, restarted the box several times.
> > > > >
> > > > > Any pointers you have would be extremely gratefully received.
> > > >
> > > > Hello Dennis,
> > > >   jdbc:postgresql:webdb is not good URL
> > > > If you database webdb and server localhost then second URL is
> >
> > good
> >
> > > > and problem is in TCP connection - what is your port ?
> > > >
> > > > regards
> > > > Haris Peco
> > >
> > > Haris et al.,
> > >
> > > I never specified a port in the install, so Postgresql should be
> > > running on the default port, 5432. I did uncomment the line in
> >
> > the
> >
> > > .conf file (all lines seem to be commmented out by default). (By
> >
> > the
> >
> > > way, my .conf file has all lines commented out, which I presume
> >
> > means
> >
> > > that it's just operating on the defaults. Is there any chance my
> > > firewall (default product shipped with Red Hat 8) would be
> > > interfering with the communication?
> > >
> > > Just in case it helps, the SQLException stack trace is this:
> > >
> > > java.sql.SQLException: Driver not found for URL:
> > > jdbc:postgresql://localhost:webdb
> > >    at 0x4028115f: java.lang.Throwable.Throwable(java.lang.String)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x402740d2: java.lang.Exception.Exception(java.lang.String)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x40316294:
> > > java.sql.SQLException.SQLException(java.lang.String,
> > > java.lang.String, int) (/usr/lib/libgcj.so.3)
> > >    at 0x40316244:
> > > java.sql.SQLException.SQLException(java.lang.String)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x40316102:
> > > java.sql.DriverManager.getConnection(java.lang.String,
> > > java.util.Properties) (/usr/lib/libgcj.so.3)
> > >    at 0x4031603a:
> > > java.sql.DriverManager.getConnection(java.lang.String,
> > > java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
> > >    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
> > >    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
> > >    at 0x40248528:
> > > _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
> > > _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
> > >    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void,
> >
> > ffi_raw,
> >
> > > void) (/usr/lib/libgcj.so.3)
> > >    at 0x4039d1bc: ?? (??:0)
> > >    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> > > (/usr/lib/libgcj.so.3)   at 0x402c60b1:
> > > gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
> > >    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int,
> >
> > byte
> >
> > > const, boolean) (/usr/lib/libgcj.so.3)
> > >    at 0x08048900: __gcj_personality_v0
> > > (jdbc.driver=org.postgresql.Driver)
> > >    at 0x420158d4: __libc_start_main
> > > (jdbc.driver=org.postgresql.Driver)
> > >    at 0x080486c1: _Jv_RegisterClasses
> > > (jdbc.driver=org.postgresql.Driver)
> > > java.sql.SQLException: Driver not found for URL:
> > > jdbc:postgresql://localhost:webdb
> >
> > Is it postgresl.jar in CLASSPATH ?
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com


Re: forName finds Driver but getConnection doesn't

From
Dennis King
Date:
Yes, that line to log into psql works fine.

--- Haris Peco <snpe@snpe.co.yu> wrote:
> Can you log in Postgresql with :
> psql -h localhost -U xxx -p 5432 -d webdb ?
>
> On Wednesday 20 November 2002 04:57 pm, Dennis King wrote:
> > I run my program with
> >
> > java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
> > -Djdbc.drivers=org.postgresql.Driver MyProgram
> >
> > By the way, I had a temporary typo in the sourceURL that shows up
> in
> > the stack trace (jdbc:postgres://host:database instead of
> > host/database) but that was only temporary.
> >
> > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> > > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > > > > Hi All. I can't get to my carefully set-up database
> through
> > >
> > > java
> > >
> > > > > with
> > > > >
> > > > > > a simple test program. I think I've hit most of the
> required
> > > > >
> > > > > set-up
> > > > >
> > > > > > points:
> > > > > >
> > > > > > * I've got all the postgresql packages installed (checked
> > >
> > > with
> > >
> > > > > rpm
> > > > >
> > > > > > -qa | grep -i postgres; they're there, including the jdbc
> > >
> > > one).
> > >
> > > > > > * I set tcpip_socket = true in
> > > > >
> > > > > /var/lib/pgsql/data/postgresql.conf.
> > > > >
> > > > > > * I also updated /etc/rc.d/init.d/ so that postmaster
> gets -o
> > > > >
> > > > > "-i";
> > > > >
> > > > > > this means that the "pg_ctl -D /var/lib/pgsql/data
> status"
> > > > >
> > > > > command
> > > > >
> > > > > > shows the -i flag was passed in.
> > > > > > * I have the right driver in the classpath (I pass in
> > >
> > > -classpath
> > >
> > > > > > /usr/share/pgsql/pgjdbc2.jar when compiling and running;
> for
> > >
> > > some
> > >
> > > > > > reason, copying the jar to /jre/lib/ext doesn't work with
> any
> > > > >
> > > > > jars
> > > > >
> > > > > > for me).
> > > > > > * I added the lines "host all 127.0.0.1 255.255.255.255
> > >
> > > trust"
> > >
> > > > > and
> > > > >
> > > > > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > > > > /var/lib/pgsql/data/pg_hba.conf
> > > > > > * I created a new database, "webdb"
> > > > > > * I added the user "xxx" with the password "yyy" to the
> > >
> > > database,
> > >
> > > > > and
> > > > >
> > > > > > verified by logging into psql with -U xxx (had
> pg_hba.conf
> > >
> > > set to
> > >
> > > > > > password so was challenged and succeeded)
> > > > > >
> > > > > > With all of this, my java program has these lines:
> > > > > >
> > > > > > Connection dbConnection = null;
> > > > > > try{
> > > > > > Class.forName("org.postgresql.Driver");
> > > > > > dbConnection =
> > > > >
> > > > > DriverManager.getConnection("jdbc:postgresql:webdb",
> > > > >
> > > > > > "xxx", "yyy");
> > > > > > }
> > > > > >
> > > > > > I get the error "java.sql.SQLException: Driver not found
> for
> > >
> > > URL:
> > > > > > jdbc:postgresql:webdb". (Note it's finding the driver
> with
> > >
> > > the
> > >
> > > > > > forName() method call).
> > > > > >
> > > > > > I've tried using jdbc:postgresql://localhost/webdb.
> > > > > >
> > > > > > I have, of course, restarted the box several times.
> > > > > >
> > > > > > Any pointers you have would be extremely gratefully
> received.
> > > > >
> > > > > Hello Dennis,
> > > > >   jdbc:postgresql:webdb is not good URL
> > > > > If you database webdb and server localhost then second URL
> is
> > >
> > > good
> > >
> > > > > and problem is in TCP connection - what is your port ?
> > > > >
> > > > > regards
> > > > > Haris Peco
> > > >
> > > > Haris et al.,
> > > >
> > > > I never specified a port in the install, so Postgresql should
> be
> > > > running on the default port, 5432. I did uncomment the line
> in
> > >
> > > the
> > >
> > > > .conf file (all lines seem to be commmented out by default).
> (By
> > >
> > > the
> > >
> > > > way, my .conf file has all lines commented out, which I
> presume
> > >
> > > means
> > >
> > > > that it's just operating on the defaults. Is there any chance
> my
> > > > firewall (default product shipped with Red Hat 8) would be
> > > > interfering with the communication?
> > > >
> > > > Just in case it helps, the SQLException stack trace is this:
> > > >
> > > > java.sql.SQLException: Driver not found for URL:
> > > > jdbc:postgresql://localhost:webdb
> > > >    at 0x4028115f:
> java.lang.Throwable.Throwable(java.lang.String)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x402740d2:
> java.lang.Exception.Exception(java.lang.String)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x40316294:
> > > > java.sql.SQLException.SQLException(java.lang.String,
> > > > java.lang.String, int) (/usr/lib/libgcj.so.3)
> > > >    at 0x40316244:
> > > > java.sql.SQLException.SQLException(java.lang.String)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x40316102:
> > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > java.util.Properties) (/usr/lib/libgcj.so.3)
> > > >    at 0x4031603a:
> > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
> > > >    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
> > > >    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
> > > >    at 0x40248528:
> > > > _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void,
> ffi_raw,
> > > > _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
> > > >    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void,
> > >
> > > ffi_raw,
> > >
> > > > void) (/usr/lib/libgcj.so.3)
> > > >    at 0x4039d1bc: ?? (??:0)
> > > >    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> > > > (/usr/lib/libgcj.so.3)   at 0x402c60b1:
> > > > gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
> > > >    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
> > > > (/usr/lib/libgcj.so.3)
>
=== message truncated ===


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: forName finds Driver but getConnection doesn't

From
Haris Peco
Date:
Is there /usr/java/jdk/jre/lib/ext/postgresql.jar and is it true
postgresql JDBC ?
I don't know if You use gcj - you try with jdk

regards
On Wednesday 20 November 2002 05:23 pm, Dennis King wrote:
> Yes, that line to log into psql works fine.
>
> --- Haris Peco <snpe@snpe.co.yu> wrote:
> > Can you log in Postgresql with :
> > psql -h localhost -U xxx -p 5432 -d webdb ?
> >
> > On Wednesday 20 November 2002 04:57 pm, Dennis King wrote:
> > > I run my program with
> > >
> > > java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
> > > -Djdbc.drivers=org.postgresql.Driver MyProgram
> > >
> > > By the way, I had a temporary typo in the sourceURL that shows up
> >
> > in
> >
> > > the stack trace (jdbc:postgres://host:database instead of
> > > host/database) but that was only temporary.
> > >
> > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> > > > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > > > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > > > > > Hi All. I can't get to my carefully set-up database
> >
> > through
> >
> > > > java
> > > >
> > > > > > with
> > > > > >
> > > > > > > a simple test program. I think I've hit most of the
> >
> > required
> >
> > > > > > set-up
> > > > > >
> > > > > > > points:
> > > > > > >
> > > > > > > * I've got all the postgresql packages installed (checked
> > > >
> > > > with
> > > >
> > > > > > rpm
> > > > > >
> > > > > > > -qa | grep -i postgres; they're there, including the jdbc
> > > >
> > > > one).
> > > >
> > > > > > > * I set tcpip_socket = true in
> > > > > >
> > > > > > /var/lib/pgsql/data/postgresql.conf.
> > > > > >
> > > > > > > * I also updated /etc/rc.d/init.d/ so that postmaster
> >
> > gets -o
> >
> > > > > > "-i";
> > > > > >
> > > > > > > this means that the "pg_ctl -D /var/lib/pgsql/data
> >
> > status"
> >
> > > > > > command
> > > > > >
> > > > > > > shows the -i flag was passed in.
> > > > > > > * I have the right driver in the classpath (I pass in
> > > >
> > > > -classpath
> > > >
> > > > > > > /usr/share/pgsql/pgjdbc2.jar when compiling and running;
> >
> > for
> >
> > > > some
> > > >
> > > > > > > reason, copying the jar to /jre/lib/ext doesn't work with
> >
> > any
> >
> > > > > > jars
> > > > > >
> > > > > > > for me).
> > > > > > > * I added the lines "host all 127.0.0.1 255.255.255.255
> > > >
> > > > trust"
> > > >
> > > > > > and
> > > > > >
> > > > > > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > > > > > /var/lib/pgsql/data/pg_hba.conf
> > > > > > > * I created a new database, "webdb"
> > > > > > > * I added the user "xxx" with the password "yyy" to the
> > > >
> > > > database,
> > > >
> > > > > > and
> > > > > >
> > > > > > > verified by logging into psql with -U xxx (had
> >
> > pg_hba.conf
> >
> > > > set to
> > > >
> > > > > > > password so was challenged and succeeded)
> > > > > > >
> > > > > > > With all of this, my java program has these lines:
> > > > > > >
> > > > > > > Connection dbConnection = null;
> > > > > > > try{
> > > > > > > Class.forName("org.postgresql.Driver");
> > > > > > > dbConnection =
> > > > > >
> > > > > > DriverManager.getConnection("jdbc:postgresql:webdb",
> > > > > >
> > > > > > > "xxx", "yyy");
> > > > > > > }
> > > > > > >
> > > > > > > I get the error "java.sql.SQLException: Driver not found
> >
> > for
> >
> > > > URL:
> > > > > > > jdbc:postgresql:webdb". (Note it's finding the driver
> >
> > with
> >
> > > > the
> > > >
> > > > > > > forName() method call).
> > > > > > >
> > > > > > > I've tried using jdbc:postgresql://localhost/webdb.
> > > > > > >
> > > > > > > I have, of course, restarted the box several times.
> > > > > > >
> > > > > > > Any pointers you have would be extremely gratefully
> >
> > received.
> >
> > > > > > Hello Dennis,
> > > > > >   jdbc:postgresql:webdb is not good URL
> > > > > > If you database webdb and server localhost then second URL
> >
> > is
> >
> > > > good
> > > >
> > > > > > and problem is in TCP connection - what is your port ?
> > > > > >
> > > > > > regards
> > > > > > Haris Peco
> > > > >
> > > > > Haris et al.,
> > > > >
> > > > > I never specified a port in the install, so Postgresql should
> >
> > be
> >
> > > > > running on the default port, 5432. I did uncomment the line
> >
> > in
> >
> > > > the
> > > >
> > > > > .conf file (all lines seem to be commmented out by default).
> >
> > (By
> >
> > > > the
> > > >
> > > > > way, my .conf file has all lines commented out, which I
> >
> > presume
> >
> > > > means
> > > >
> > > > > that it's just operating on the defaults. Is there any chance
> >
> > my
> >
> > > > > firewall (default product shipped with Red Hat 8) would be
> > > > > interfering with the communication?
> > > > >
> > > > > Just in case it helps, the SQLException stack trace is this:
> > > > >
> > > > > java.sql.SQLException: Driver not found for URL:
> > > > > jdbc:postgresql://localhost:webdb
> > > > >    at 0x4028115f:
> >
> > java.lang.Throwable.Throwable(java.lang.String)
> >
> > > > > (/usr/lib/libgcj.so.3)
> > > > >    at 0x402740d2:
> >
> > java.lang.Exception.Exception(java.lang.String)
> >
> > > > > (/usr/lib/libgcj.so.3)
> > > > >    at 0x40316294:
> > > > > java.sql.SQLException.SQLException(java.lang.String,
> > > > > java.lang.String, int) (/usr/lib/libgcj.so.3)
> > > > >    at 0x40316244:
> > > > > java.sql.SQLException.SQLException(java.lang.String)
> > > > > (/usr/lib/libgcj.so.3)
> > > > >    at 0x40316102:
> > > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > > java.util.Properties) (/usr/lib/libgcj.so.3)
> > > > >    at 0x4031603a:
> > > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > > java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
> > > > >    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
> > > > >    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
> > > > >    at 0x40248528:
> > > > > _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> > > > > (/usr/lib/libgcj.so.3)
> > > > >    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void,
> >
> > ffi_raw,
> >
> > > > > _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
> > > > >    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void,
> > > >
> > > > ffi_raw,
> > > >
> > > > > void) (/usr/lib/libgcj.so.3)
> > > > >    at 0x4039d1bc: ?? (??:0)
> > > > >    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> > > > > (/usr/lib/libgcj.so.3)   at 0x402c60b1:
> > > > > gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
> > > > >    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
> > > > > (/usr/lib/libgcj.so.3)
>
> === message truncated ===
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
> ---------------------------(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: forName finds Driver but getConnection doesn't

From
Alex Dovlecel
Date:
> I run my program with
>
> java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
> -Djdbc.drivers=org.postgresql.Driver MyProgram
>
> By the way, I had a temporary typo in the sourceURL that shows up in
> the stack trace (jdbc:postgres://host:database instead of
> host/database) but that was only temporary.

My URL looks like this:
jdbc:postgresql://localhost/webdb

cred ca tre sa fie POSTGRESQL !!! nu jdbc:postgres

HIH
dovle

>
> --- Haris Peco <snpe@snpe.co.yu> wrote:
> > On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > > > Hi All. I can't get to my carefully set-up database through
> >
> > java
> >
> > > > with
> > > >
> > > > > a simple test program. I think I've hit most of the required
> > > >
> > > > set-up
> > > >
> > > > > points:
> > > > >
> > > > > * I've got all the postgresql packages installed (checked
> >
> > with
> >
> > > > rpm
> > > >
> > > > > -qa | grep -i postgres; they're there, including the jdbc
> >
> > one).
> >
> > > > > * I set tcpip_socket = true in
> > > >
> > > > /var/lib/pgsql/data/postgresql.conf.
> > > >
> > > > > * I also updated /etc/rc.d/init.d/ so that postmaster gets -o
> > > >
> > > > "-i";
> > > >
> > > > > this means that the "pg_ctl -D /var/lib/pgsql/data status"
> > > >
> > > > command
> > > >
> > > > > shows the -i flag was passed in.
> > > > > * I have the right driver in the classpath (I pass in
> >
> > -classpath
> >
> > > > > /usr/share/pgsql/pgjdbc2.jar when compiling and running; for
> >
> > some
> >
> > > > > reason, copying the jar to /jre/lib/ext doesn't work with any
> > > >
> > > > jars
> > > >
> > > > > for me).
> > > > > * I added the lines "host all 127.0.0.1 255.255.255.255
> >
> > trust"
> >
> > > > and
> > > >
> > > > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > > > /var/lib/pgsql/data/pg_hba.conf
> > > > > * I created a new database, "webdb"
> > > > > * I added the user "xxx" with the password "yyy" to the
> >
> > database,
> >
> > > > and
> > > >
> > > > > verified by logging into psql with -U xxx (had pg_hba.conf
> >
> > set to
> >
> > > > > password so was challenged and succeeded)
> > > > >
> > > > > With all of this, my java program has these lines:
> > > > >
> > > > > Connection dbConnection = null;
> > > > > try{
> > > > > Class.forName("org.postgresql.Driver");
> > > > > dbConnection =
> > > >
> > > > DriverManager.getConnection("jdbc:postgresql:webdb",
> > > >
> > > > > "xxx", "yyy");
> > > > > }
> > > > >
> > > > > I get the error "java.sql.SQLException: Driver not found for
> >
> > URL:
> > > > > jdbc:postgresql:webdb". (Note it's finding the driver with
> >
> > the
> >
> > > > > forName() method call).
> > > > >
> > > > > I've tried using jdbc:postgresql://localhost/webdb.
> > > > >
> > > > > I have, of course, restarted the box several times.
> > > > >
> > > > > Any pointers you have would be extremely gratefully received.
> > > >
> > > > Hello Dennis,
> > > >   jdbc:postgresql:webdb is not good URL
> > > > If you database webdb and server localhost then second URL is
> >
> > good
> >
> > > > and problem is in TCP connection - what is your port ?
> > > >
> > > > regards
> > > > Haris Peco
> > >
> > > Haris et al.,
> > >
> > > I never specified a port in the install, so Postgresql should be
> > > running on the default port, 5432. I did uncomment the line in
> >
> > the
> >
> > > .conf file (all lines seem to be commmented out by default). (By
> >
> > the
> >
> > > way, my .conf file has all lines commented out, which I presume
> >
> > means
> >
> > > that it's just operating on the defaults. Is there any chance my
> > > firewall (default product shipped with Red Hat 8) would be
> > > interfering with the communication?
> > >
> > > Just in case it helps, the SQLException stack trace is this:
> > >
> > > java.sql.SQLException: Driver not found for URL:
> > > jdbc:postgresql://localhost:webdb
> > >    at 0x4028115f: java.lang.Throwable.Throwable(java.lang.String)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x402740d2: java.lang.Exception.Exception(java.lang.String)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x40316294:
> > > java.sql.SQLException.SQLException(java.lang.String,
> > > java.lang.String, int) (/usr/lib/libgcj.so.3)
> > >    at 0x40316244:
> > > java.sql.SQLException.SQLException(java.lang.String)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x40316102:
> > > java.sql.DriverManager.getConnection(java.lang.String,
> > > java.util.Properties) (/usr/lib/libgcj.so.3)
> > >    at 0x4031603a:
> > > java.sql.DriverManager.getConnection(java.lang.String,
> > > java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
> > >    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
> > >    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
> > >    at 0x40248528:
> > > _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
> > > _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
> > >    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void,
> >
> > ffi_raw,
> >
> > > void) (/usr/lib/libgcj.so.3)
> > >    at 0x4039d1bc: ?? (??:0)
> > >    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> > > (/usr/lib/libgcj.so.3)   at 0x402c60b1:
> > > gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
> > >    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
> > > (/usr/lib/libgcj.so.3)
> > >    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int,
> >
> > byte
> >
> > > const, boolean) (/usr/lib/libgcj.so.3)
> > >    at 0x08048900: __gcj_personality_v0
> > > (jdbc.driver=org.postgresql.Driver)
> > >    at 0x420158d4: __libc_start_main
> > > (jdbc.driver=org.postgresql.Driver)
> > >    at 0x080486c1: _Jv_RegisterClasses
> > > (jdbc.driver=org.postgresql.Driver)
> > > java.sql.SQLException: Driver not found for URL:
> > > jdbc:postgresql://localhost:webdb
> >
> > Is it postgresl.jar in CLASSPATH ?
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html

Re: forName finds Driver but getConnection doesn't

From
Alex Dovlecel
Date:
On Wednesday 20 November 2002 19:30, Alex Dovlecel wrote:
> > I run my program with
> >
> > java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
> > -Djdbc.drivers=org.postgresql.Driver MyProgram
> >
> > By the way, I had a temporary typo in the sourceURL that shows up in
> > the stack trace (jdbc:postgres://host:database instead of
> > host/database) but that was only temporary.
>
> My URL looks like this:
> jdbc:postgresql://localhost/webdb
>

Sorry, forgot to switch the language output stream :o)))

The translation is:

I think must be postgresql instead of postgres.

>
> HIH
> dovle
>
> > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> > > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > > > > Hi All. I can't get to my carefully set-up database through
> > >
> > > java
> > >
> > > > > with
> > > > >
> > > > > > a simple test program. I think I've hit most of the required
> > > > >
> > > > > set-up
> > > > >
> > > > > > points:
> > > > > >
> > > > > > * I've got all the postgresql packages installed (checked
> > >
> > > with
> > >
> > > > > rpm
> > > > >
> > > > > > -qa | grep -i postgres; they're there, including the jdbc
> > >
> > > one).
> > >
> > > > > > * I set tcpip_socket = true in
> > > > >
> > > > > /var/lib/pgsql/data/postgresql.conf.
> > > > >
> > > > > > * I also updated /etc/rc.d/init.d/ so that postmaster gets -o
> > > > >
> > > > > "-i";
> > > > >
> > > > > > this means that the "pg_ctl -D /var/lib/pgsql/data status"
> > > > >
> > > > > command
> > > > >
> > > > > > shows the -i flag was passed in.
> > > > > > * I have the right driver in the classpath (I pass in
> > >
> > > -classpath
> > >
> > > > > > /usr/share/pgsql/pgjdbc2.jar when compiling and running; for
> > >
> > > some
> > >
> > > > > > reason, copying the jar to /jre/lib/ext doesn't work with any
> > > > >
> > > > > jars
> > > > >
> > > > > > for me).
> > > > > > * I added the lines "host all 127.0.0.1 255.255.255.255
> > >
> > > trust"
> > >
> > > > > and
> > > > >
> > > > > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > > > > /var/lib/pgsql/data/pg_hba.conf
> > > > > > * I created a new database, "webdb"
> > > > > > * I added the user "xxx" with the password "yyy" to the
> > >
> > > database,
> > >
> > > > > and
> > > > >
> > > > > > verified by logging into psql with -U xxx (had pg_hba.conf
> > >
> > > set to
> > >
> > > > > > password so was challenged and succeeded)
> > > > > >
> > > > > > With all of this, my java program has these lines:
> > > > > >
> > > > > > Connection dbConnection = null;
> > > > > > try{
> > > > > > Class.forName("org.postgresql.Driver");
> > > > > > dbConnection =
> > > > >
> > > > > DriverManager.getConnection("jdbc:postgresql:webdb",
> > > > >
> > > > > > "xxx", "yyy");
> > > > > > }
> > > > > >
> > > > > > I get the error "java.sql.SQLException: Driver not found for
> > >
> > > URL:
> > > > > > jdbc:postgresql:webdb". (Note it's finding the driver with
> > >
> > > the
> > >
> > > > > > forName() method call).
> > > > > >
> > > > > > I've tried using jdbc:postgresql://localhost/webdb.
> > > > > >
> > > > > > I have, of course, restarted the box several times.
> > > > > >
> > > > > > Any pointers you have would be extremely gratefully received.
> > > > >
> > > > > Hello Dennis,
> > > > >   jdbc:postgresql:webdb is not good URL
> > > > > If you database webdb and server localhost then second URL is
> > >
> > > good
> > >
> > > > > and problem is in TCP connection - what is your port ?
> > > > >
> > > > > regards
> > > > > Haris Peco
> > > >
> > > > Haris et al.,
> > > >
> > > > I never specified a port in the install, so Postgresql should be
> > > > running on the default port, 5432. I did uncomment the line in
> > >
> > > the
> > >
> > > > .conf file (all lines seem to be commmented out by default). (By
> > >
> > > the
> > >
> > > > way, my .conf file has all lines commented out, which I presume
> > >
> > > means
> > >
> > > > that it's just operating on the defaults. Is there any chance my
> > > > firewall (default product shipped with Red Hat 8) would be
> > > > interfering with the communication?
> > > >
> > > > Just in case it helps, the SQLException stack trace is this:
> > > >
> > > > java.sql.SQLException: Driver not found for URL:
> > > > jdbc:postgresql://localhost:webdb
> > > >    at 0x4028115f: java.lang.Throwable.Throwable(java.lang.String)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x402740d2: java.lang.Exception.Exception(java.lang.String)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x40316294:
> > > > java.sql.SQLException.SQLException(java.lang.String,
> > > > java.lang.String, int) (/usr/lib/libgcj.so.3)
> > > >    at 0x40316244:
> > > > java.sql.SQLException.SQLException(java.lang.String)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x40316102:
> > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > java.util.Properties) (/usr/lib/libgcj.so.3)
> > > >    at 0x4031603a:
> > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
> > > >    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
> > > >    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
> > > >    at 0x40248528:
> > > > _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x40248e34: _Jv_InterpMethod.run(ffi_cif, void, ffi_raw,
> > > > _Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.3)
> > > >    at 0x40246424: _Jv_InterpMethod.run_normal(ffi_cif, void,
> > >
> > > ffi_raw,
> > >
> > > > void) (/usr/lib/libgcj.so.3)
> > > >    at 0x4039d1bc: ?? (??:0)
> > > >    at 0x4025b308: gnu.gcj.runtime.FirstThread.call_main()
> > > > (/usr/lib/libgcj.so.3)   at 0x402c60b1:
> > > > gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.3)
> > > >    at 0x40267fdc: _Jv_ThreadRun(java.lang.Thread)
> > > > (/usr/lib/libgcj.so.3)
> > > >    at 0x4023478c: _Jv_RunMain(java.lang.Class, byte const, int,
> > >
> > > byte
> > >
> > > > const, boolean) (/usr/lib/libgcj.so.3)
> > > >    at 0x08048900: __gcj_personality_v0
> > > > (jdbc.driver=org.postgresql.Driver)
> > > >    at 0x420158d4: __libc_start_main
> > > > (jdbc.driver=org.postgresql.Driver)
> > > >    at 0x080486c1: _Jv_RegisterClasses
> > > > (jdbc.driver=org.postgresql.Driver)
> > > > java.sql.SQLException: Driver not found for URL:
> > > > jdbc:postgresql://localhost:webdb
> > >
> > > Is it postgresl.jar in CLASSPATH ?
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Web Hosting - Let the expert host your site
> > http://webhosting.yahoo.com
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: Have you checked our extensive FAQ?
> >
> > http://www.postgresql.org/users-lounge/docs/faq.html
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

Re: forName finds Driver but getConnection doesn't

From
Dennis King
Date:
Another typo. Sorry. I'm using 'postgresql'. I've tried every
imaginable variant. I'm thinking I need to compile my own version
instead of using Red Hat's. Though of course 7.2.2 won't compile,
errors regarding classes ResultSet and Statement not declared as
abstract for not declaring methods. 7.2.3, here I come. Unless
someone can suggest a better way to get at usable binaries with jdbc
support.

Thanks everyone for your help. It sounds like I'm doing everything
right, but something somewhere you don't usually touch is wrong.


--- Alex Dovlecel <dovle@kbs.twi.tudelft.nl> wrote:
> On Wednesday 20 November 2002 19:30, Alex Dovlecel wrote:
> > > I run my program with
> > >
> > > java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
> > > -Djdbc.drivers=org.postgresql.Driver MyProgram
> > >
> > > By the way, I had a temporary typo in the sourceURL that shows
> up in
> > > the stack trace (jdbc:postgres://host:database instead of
> > > host/database) but that was only temporary.
> >
> > My URL looks like this:
> > jdbc:postgresql://localhost/webdb
> >
>
> Sorry, forgot to switch the language output stream :o)))
>
> The translation is:
>
> I think must be postgresql instead of postgres.
>
> >
> > HIH
> > dovle
> >
> > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
> > > > > --- Haris Peco <snpe@snpe.co.yu> wrote:
> > > > > > On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
> > > > > > > Hi All. I can't get to my carefully set-up database
> through
> > > >
> > > > java
> > > >
> > > > > > with
> > > > > >
> > > > > > > a simple test program. I think I've hit most of the
> required
> > > > > >
> > > > > > set-up
> > > > > >
> > > > > > > points:
> > > > > > >
> > > > > > > * I've got all the postgresql packages installed
> (checked
> > > >
> > > > with
> > > >
> > > > > > rpm
> > > > > >
> > > > > > > -qa | grep -i postgres; they're there, including the
> jdbc
> > > >
> > > > one).
> > > >
> > > > > > > * I set tcpip_socket = true in
> > > > > >
> > > > > > /var/lib/pgsql/data/postgresql.conf.
> > > > > >
> > > > > > > * I also updated /etc/rc.d/init.d/ so that postmaster
> gets -o
> > > > > >
> > > > > > "-i";
> > > > > >
> > > > > > > this means that the "pg_ctl -D /var/lib/pgsql/data
> status"
> > > > > >
> > > > > > command
> > > > > >
> > > > > > > shows the -i flag was passed in.
> > > > > > > * I have the right driver in the classpath (I pass in
> > > >
> > > > -classpath
> > > >
> > > > > > > /usr/share/pgsql/pgjdbc2.jar when compiling and
> running; for
> > > >
> > > > some
> > > >
> > > > > > > reason, copying the jar to /jre/lib/ext doesn't work
> with any
> > > > > >
> > > > > > jars
> > > > > >
> > > > > > > for me).
> > > > > > > * I added the lines "host all 127.0.0.1 255.255.255.255
> > > >
> > > > trust"
> > > >
> > > > > > and
> > > > > >
> > > > > > > "host all 192.168.0.0 255.255.0.0 trust" to
> > > > > > > /var/lib/pgsql/data/pg_hba.conf
> > > > > > > * I created a new database, "webdb"
> > > > > > > * I added the user "xxx" with the password "yyy" to the
> > > >
> > > > database,
> > > >
> > > > > > and
> > > > > >
> > > > > > > verified by logging into psql with -U xxx (had
> pg_hba.conf
> > > >
> > > > set to
> > > >
> > > > > > > password so was challenged and succeeded)
> > > > > > >
> > > > > > > With all of this, my java program has these lines:
> > > > > > >
> > > > > > > Connection dbConnection = null;
> > > > > > > try{
> > > > > > > Class.forName("org.postgresql.Driver");
> > > > > > > dbConnection =
> > > > > >
> > > > > > DriverManager.getConnection("jdbc:postgresql:webdb",
> > > > > >
> > > > > > > "xxx", "yyy");
> > > > > > > }
> > > > > > >
> > > > > > > I get the error "java.sql.SQLException: Driver not
> found for
> > > >
> > > > URL:
> > > > > > > jdbc:postgresql:webdb". (Note it's finding the driver
> with
> > > >
> > > > the
> > > >
> > > > > > > forName() method call).
> > > > > > >
> > > > > > > I've tried using jdbc:postgresql://localhost/webdb.
> > > > > > >
> > > > > > > I have, of course, restarted the box several times.
> > > > > > >
> > > > > > > Any pointers you have would be extremely gratefully
> received.
> > > > > >
> > > > > > Hello Dennis,
> > > > > >   jdbc:postgresql:webdb is not good URL
> > > > > > If you database webdb and server localhost then second
> URL is
> > > >
> > > > good
> > > >
> > > > > > and problem is in TCP connection - what is your port ?
> > > > > >
> > > > > > regards
> > > > > > Haris Peco
> > > > >
> > > > > Haris et al.,
> > > > >
> > > > > I never specified a port in the install, so Postgresql
> should be
> > > > > running on the default port, 5432. I did uncomment the line
> in
> > > >
> > > > the
> > > >
> > > > > .conf file (all lines seem to be commmented out by
> default). (By
> > > >
> > > > the
> > > >
> > > > > way, my .conf file has all lines commented out, which I
> presume
> > > >
> > > > means
> > > >
> > > > > that it's just operating on the defaults. Is there any
> chance my
> > > > > firewall (default product shipped with Red Hat 8) would be
> > > > > interfering with the communication?
> > > > >
> > > > > Just in case it helps, the SQLException stack trace is
> this:
> > > > >
> > > > > java.sql.SQLException: Driver not found for URL:
> > > > > jdbc:postgresql://localhost:webdb
> > > > >    at 0x4028115f:
> java.lang.Throwable.Throwable(java.lang.String)
> > > > > (/usr/lib/libgcj.so.3)
> > > > >    at 0x402740d2:
> java.lang.Exception.Exception(java.lang.String)
> > > > > (/usr/lib/libgcj.so.3)
> > > > >    at 0x40316294:
> > > > > java.sql.SQLException.SQLException(java.lang.String,
> > > > > java.lang.String, int) (/usr/lib/libgcj.so.3)
> > > > >    at 0x40316244:
> > > > > java.sql.SQLException.SQLException(java.lang.String)
> > > > > (/usr/lib/libgcj.so.3)
> > > > >    at 0x40316102:
> > > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > > java.util.Properties) (/usr/lib/libgcj.so.3)
> > > > >    at 0x4031603a:
> > > > > java.sql.DriverManager.getConnection(java.lang.String,
> > > > > java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
> > > > >    at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
> > > > >    at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
> > > > >    at 0x40248528:
> > > > > _Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
> > > > > (/usr/lib/libgcj.so.3)
>
=== message truncated ===


__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

Re: forName finds Driver but getConnection doesn't

From
Barry Lind
Date:
Dennis,

This might be a long shot but I noticed the following in your emails:

You appear to be doing both:
-Djdbc.drivers=org.postgresql.Driver
and
Class.forName("org.postgresql.Driver");

Only one or the other should be necessary.  Perhaps because you are
using both methods to load the driver, you are seeing a problem, just a
guess.

thanks,
--Barry


Dennis King wrote:
> Another typo. Sorry. I'm using 'postgresql'. I've tried every
> imaginable variant. I'm thinking I need to compile my own version
> instead of using Red Hat's. Though of course 7.2.2 won't compile,
> errors regarding classes ResultSet and Statement not declared as
> abstract for not declaring methods. 7.2.3, here I come. Unless
> someone can suggest a better way to get at usable binaries with jdbc
> support.
>
> Thanks everyone for your help. It sounds like I'm doing everything
> right, but something somewhere you don't usually touch is wrong.
>
>
> --- Alex Dovlecel <dovle@kbs.twi.tudelft.nl> wrote:
>
>>On Wednesday 20 November 2002 19:30, Alex Dovlecel wrote:
>>
>>>>I run my program with
>>>>
>>>>java -cp /usr/java/jdk/jre/lib/ext/postgresql.jar:.
>>>>-Djdbc.drivers=org.postgresql.Driver MyProgram
>>>>
>>>>By the way, I had a temporary typo in the sourceURL that shows
>>>
>>up in
>>
>>>>the stack trace (jdbc:postgres://host:database instead of
>>>>host/database) but that was only temporary.
>>>
>>>My URL looks like this:
>>>jdbc:postgresql://localhost/webdb
>>>
>>
>>Sorry, forgot to switch the language output stream :o)))
>>
>>The translation is:
>>
>>I think must be postgresql instead of postgres.
>>
>>
>>>HIH
>>>dovle
>>>
>>>
>>>>--- Haris Peco <snpe@snpe.co.yu> wrote:
>>>>
>>>>>On Wednesday 20 November 2002 04:20 pm, Dennis King wrote:
>>>>>
>>>>>>--- Haris Peco <snpe@snpe.co.yu> wrote:
>>>>>>
>>>>>>>On Tuesday 19 November 2002 11:46 pm, Dennis King wrote:
>>>>>>>
>>>>>>>>Hi All. I can't get to my carefully set-up database
>>>>>>>
>>through
>>
>>>>>java
>>>>>
>>>>>
>>>>>>>with
>>>>>>>
>>>>>>>
>>>>>>>>a simple test program. I think I've hit most of the
>>>>>>>
>>required
>>
>>>>>>>set-up
>>>>>>>
>>>>>>>
>>>>>>>>points:
>>>>>>>>
>>>>>>>>* I've got all the postgresql packages installed
>>>>>>>
>>(checked
>>
>>>>>with
>>>>>
>>>>>
>>>>>>>rpm
>>>>>>>
>>>>>>>
>>>>>>>>-qa | grep -i postgres; they're there, including the
>>>>>>>
>>jdbc
>>
>>>>>one).
>>>>>
>>>>>
>>>>>>>>* I set tcpip_socket = true in
>>>>>>>
>>>>>>>/var/lib/pgsql/data/postgresql.conf.
>>>>>>>
>>>>>>>
>>>>>>>>* I also updated /etc/rc.d/init.d/ so that postmaster
>>>>>>>
>>gets -o
>>
>>>>>>>"-i";
>>>>>>>
>>>>>>>
>>>>>>>>this means that the "pg_ctl -D /var/lib/pgsql/data
>>>>>>>
>>status"
>>
>>>>>>>command
>>>>>>>
>>>>>>>
>>>>>>>>shows the -i flag was passed in.
>>>>>>>>* I have the right driver in the classpath (I pass in
>>>>>>>
>>>>>-classpath
>>>>>
>>>>>
>>>>>>>>/usr/share/pgsql/pgjdbc2.jar when compiling and
>>>>>>>
>>running; for
>>
>>>>>some
>>>>>
>>>>>
>>>>>>>>reason, copying the jar to /jre/lib/ext doesn't work
>>>>>>>
>>with any
>>
>>>>>>>jars
>>>>>>>
>>>>>>>
>>>>>>>>for me).
>>>>>>>>* I added the lines "host all 127.0.0.1 255.255.255.255
>>>>>>>
>>>>>trust"
>>>>>
>>>>>
>>>>>>>and
>>>>>>>
>>>>>>>
>>>>>>>>"host all 192.168.0.0 255.255.0.0 trust" to
>>>>>>>>/var/lib/pgsql/data/pg_hba.conf
>>>>>>>>* I created a new database, "webdb"
>>>>>>>>* I added the user "xxx" with the password "yyy" to the
>>>>>>>
>>>>>database,
>>>>>
>>>>>
>>>>>>>and
>>>>>>>
>>>>>>>
>>>>>>>>verified by logging into psql with -U xxx (had
>>>>>>>
>>pg_hba.conf
>>
>>>>>set to
>>>>>
>>>>>
>>>>>>>>password so was challenged and succeeded)
>>>>>>>>
>>>>>>>>With all of this, my java program has these lines:
>>>>>>>>
>>>>>>>>Connection dbConnection = null;
>>>>>>>>try{
>>>>>>>>Class.forName("org.postgresql.Driver");
>>>>>>>>dbConnection =
>>>>>>>
>>>>>>>DriverManager.getConnection("jdbc:postgresql:webdb",
>>>>>>>
>>>>>>>
>>>>>>>>"xxx", "yyy");
>>>>>>>>}
>>>>>>>>
>>>>>>>>I get the error "java.sql.SQLException: Driver not
>>>>>>>
>>found for
>>
>>>>>URL:
>>>>>
>>>>>>>>jdbc:postgresql:webdb". (Note it's finding the driver
>>>>>>>
>>with
>>
>>>>>the
>>>>>
>>>>>
>>>>>>>>forName() method call).
>>>>>>>>
>>>>>>>>I've tried using jdbc:postgresql://localhost/webdb.
>>>>>>>>
>>>>>>>>I have, of course, restarted the box several times.
>>>>>>>>
>>>>>>>>Any pointers you have would be extremely gratefully
>>>>>>>
>>received.
>>
>>>>>>>Hello Dennis,
>>>>>>>  jdbc:postgresql:webdb is not good URL
>>>>>>>If you database webdb and server localhost then second
>>>>>>
>>URL is
>>
>>>>>good
>>>>>
>>>>>
>>>>>>>and problem is in TCP connection - what is your port ?
>>>>>>>
>>>>>>>regards
>>>>>>>Haris Peco
>>>>>>
>>>>>>Haris et al.,
>>>>>>
>>>>>>I never specified a port in the install, so Postgresql
>>>>>
>>should be
>>
>>>>>>running on the default port, 5432. I did uncomment the line
>>>>>
>>in
>>
>>>>>the
>>>>>
>>>>>
>>>>>>.conf file (all lines seem to be commmented out by
>>>>>
>>default). (By
>>
>>>>>the
>>>>>
>>>>>
>>>>>>way, my .conf file has all lines commented out, which I
>>>>>
>>presume
>>
>>>>>means
>>>>>
>>>>>
>>>>>>that it's just operating on the defaults. Is there any
>>>>>
>>chance my
>>
>>>>>>firewall (default product shipped with Red Hat 8) would be
>>>>>>interfering with the communication?
>>>>>>
>>>>>>Just in case it helps, the SQLException stack trace is
>>>>>
>>this:
>>
>>>>>>java.sql.SQLException: Driver not found for URL:
>>>>>>jdbc:postgresql://localhost:webdb
>>>>>>   at 0x4028115f:
>>>>>
>>java.lang.Throwable.Throwable(java.lang.String)
>>
>>>>>>(/usr/lib/libgcj.so.3)
>>>>>>   at 0x402740d2:
>>>>>
>>java.lang.Exception.Exception(java.lang.String)
>>
>>>>>>(/usr/lib/libgcj.so.3)
>>>>>>   at 0x40316294:
>>>>>>java.sql.SQLException.SQLException(java.lang.String,
>>>>>>java.lang.String, int) (/usr/lib/libgcj.so.3)
>>>>>>   at 0x40316244:
>>>>>>java.sql.SQLException.SQLException(java.lang.String)
>>>>>>(/usr/lib/libgcj.so.3)
>>>>>>   at 0x40316102:
>>>>>>java.sql.DriverManager.getConnection(java.lang.String,
>>>>>>java.util.Properties) (/usr/lib/libgcj.so.3)
>>>>>>   at 0x4031603a:
>>>>>>java.sql.DriverManager.getConnection(java.lang.String,
>>>>>>java.lang.String, java.lang.String) (/usr/lib/libgcj.so.3)
>>>>>>   at 0x4039d347: ffi_call_SYSV (/usr/lib/libgcj.so.3)
>>>>>>   at 0x4039d307: ffi_raw_call (/usr/lib/libgcj.so.3)
>>>>>>   at 0x40248528:
>>>>>>_Jv_InterpMethod.continue1(_Jv_InterpMethodInvocation)
>>>>>>(/usr/lib/libgcj.so.3)
>>>>>
> === message truncated ===
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>



Re: forName finds Driver but getConnection doesn't

From
Fernando Nasser
Date:
Denis,

Your session is set up with the GNU gcj as the compiler/jvm.
If you try 'which java" you will probably get /usr/bin/java,
which is _not_ the SDK/JRE one.

You must set your JDBC_HOME env variable, maybe your CLASSPATH if you do
not copy your driver there, but if you have installed the GNU gcj
program you must also make sure the SKD (or JRE) bin dir is earlier in
your path so that 'which java" points to the right thing.

I use RHDB (many versions) and the JDBC driver with all variants of JREs
every day, in machines with several different versions of the RHL OS,
without any problems so far.

Best regards,
Fernando

Dennis King wrote:

> java.sql.SQLException.SQLException(java.lang.String,
> java.lang.String, int) (/usr/lib/libgcj.so.3)

                                     ^^^^^ (GNU gcj being used)

--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Re: forName finds Driver but getConnection doesn't

From
Dennis King
Date:
Thanks Fernando. Please note that I did NOT install GCJ. It was
either included with the 8.0 distribution or included with a Jakarta
package.

--- Fernando Nasser <fnasser@redhat.com> wrote:
> Denis,
>
> Your session is set up with the GNU gcj as the compiler/jvm.
> If you try 'which java" you will probably get /usr/bin/java,
> which is _not_ the SDK/JRE one.
>
> You must set your JDBC_HOME env variable, maybe your CLASSPATH if
> you do
> not copy your driver there, but if you have installed the GNU gcj
> program you must also make sure the SKD (or JRE) bin dir is earlier
> in
> your path so that 'which java" points to the right thing.
>
> I use RHDB (many versions) and the JDBC driver with all variants of
> JREs
> every day, in machines with several different versions of the RHL
> OS,
> without any problems so far.
>
> Best regards,
> Fernando
>
> Dennis King wrote:
>
> > java.sql.SQLException.SQLException(java.lang.String,
> > java.lang.String, int) (/usr/lib/libgcj.so.3)
>
>                                      ^^^^^ (GNU gcj being used)
>
> --
> Fernando Nasser
> Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario   M4P 2C9
>


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Re: forName finds Driver but getConnection doesn't

From
Fernando Nasser
Date:
Dennis King wrote:
> Thanks Fernando. Please note that I did NOT install GCJ. It was
> either included with the 8.0 distribution or included with a Jakarta
> package.
>

It is available with the 8.0.  Maybe it is automatically selected as
part of the type of installation you've chosen... or maybe it was there
but it was not disturbing you.  The gij program only stated to be called
   as the 'java' command with the 8.0 release.


--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


Re: forName finds Driver but getConnection doesn't

From
Dennis King
Date:
Am I right that what this means is that the Java installation one
installs from Sun is trumped by GCJ (a package that I didn't choose,
it's just part of a server OS install)? If so, the Red Hat
documentation doesn't mention it and so following the documentation
as I did will lead to a JDBC failure. Sounds like the documentation
needs to be updated to alert people to this potential problem. Which
was the point of this note to the list, so hopefully we've helped
some people out. (And hopefully you can encourage the process of
getting the doc updates done.)

Thanks for all the info.

--- Fernando Nasser <fnasser@redhat.com> wrote:
> Dennis King wrote:
> > Thanks Fernando. Please note that I did NOT install GCJ. It was
> > either included with the 8.0 distribution or included with a
> Jakarta
> > package.
> >
>
> It is available with the 8.0.  Maybe it is automatically selected
> as
> part of the type of installation you've chosen... or maybe it was
> there
> but it was not disturbing you.  The gij program only stated to be
> called
>    as the 'java' command with the 8.0 release.
>
>
> --
> Fernando Nasser
> Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
> 2323 Yonge Street, Suite #300
> Toronto, Ontario   M4P 2C9
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com