Thread: Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC

Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC

From
Peter T Mount
Date:
[ forwarding to the interfaces list ]

On Wed, 18 Mar 1998, Pierre Habraken wrote:

> I am trying to set up a connection to PostgreSql from JBuilder using the
> JDBC driver, but for now all my attempts have failed.
>
> I first compiled, tested and installed the driver on my NT 4
> workstation. Then I followed the instructions given in the JBuilder
> (Professionnal) Programming Guide:
> 1) Create a new project and a new application.
> 2) Add a Database component
> 3) Open the connection editor
> 4) Fill up the fields inside the connection editor window:
>         URL Connection = jdbc:postgresql://server/database
>         User Name = postgres
>         Driver Class = postgresql.Driver
>    and select the option 'Ask for user password'
> 5) Push down the button 'Connection test'. JBuilder pop then a message
>    dialog up telling me: "no suitable driver" !

That's because the driver isn't loaded. Two ways to do this:

1) Add -Djdbc.drivers=postgresql.Driver although this won't work for
JBuilder.

2) Add something like:
      Class.forName("postgresql.Driver");
to your code.


> The archive file postgresql.jar being installed in
> C:\JBuilder\myclasses, I added the path
> C:\JBuilder\myclasses\postgresql.jar to the list of default class paths,
> using the environment options editor accessed from the JBuilder menu
> 'Tools/EDI...'.
>
> I wonder what is wrong in what I am doing.
> Has anyone got successful results in trying to build a pure Java C/S
> application using JBuilder, JDBC and PosgreSql ?
>
> I would really appreciate any advice.

Can someone who's got more details for JBuilder to reply let him know, &
CC me so I can add it to the docs.

Thanks, Peter

--
Peter T Mount  petermount@earthling.net or pmount@maidast.demon.co.uk
Main Homepage: http://www.demon.co.uk/finder
Work Homepage: http://www.maidstone.gov.uk Work EMail: peter@maidstone.gov.uk


Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC

From
Pierre Habraken
Date:
Peter T Mount wrote:
>
> That's because the driver isn't loaded. Two ways to do this:
>
> 1) Add -Djdbc.drivers=postgresql.Driver although this won't work for
> JBuilder.
>
> 2) Add something like:
>           Class.forName("postgresql.Driver");
> to your code.

Thanks for your reply.
I tried adding the explicit loading of the driver in the java code, but
this had no effect, which is not surprising in my mind.
It is not clear whether the fact that JBuilder components does not
behave well is due to these components or to the JBDC driver...

Pierre
--
________________________________________________________________________
Pierre HABRAKEN - mailto:Pierre.Habraken@ujf-grenoble.fr
Tél: 04 76 51 48 87 - Fax: 04 76 51 45 63
Université Joseph Fourier - Département Scientifique Universitaire
Adresse postale : CAFIM/DSU BP53 38041 Grenoble Cedex 9
________________________________________________________________________