pg.ddx.io pgsql-interfaces@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
9+ messages / 3 participants
[nested] [flat]
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-18 19:00 Peter T Mount <postgresdev@maidast.demon.co.uk>
0 siblings, 1 reply; 9+ messages in thread
From: Peter T Mount @ 1998-03-18 19:00 UTC (permalink / raw)
To: Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>; +Cc: pgsql-interfaces
[ 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
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-19 13:16 Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
parent: Peter T Mount <postgresdev@maidast.demon.co.uk>
0 siblings, 0 replies; 9+ messages in thread
From: Pierre Habraken @ 1998-03-19 13:16 UTC (permalink / raw)
To: Peter T Mount <postgresdev@maidast.demon.co.uk>; +Cc: pgsql-interfaces
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
________________________________________________________________________
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-20 13:45 Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
0 siblings, 1 reply; 9+ messages in thread
From: Pierre Habraken @ 1998-03-20 13:45 UTC (permalink / raw)
To: Aaron Dunlop <dunlopa@adscomputers.com>; +Cc: pgsql-questions@postgreSQL.org; pgsql-interfaces
Aaron Dunlop wrote:
>
> I've gotten JDBC connections from JBuilder, but only queries - no
> updates.
>
> To get the connection to work from within the IDE (e.g. when the
> application is not actually running) you have to add the path to
> postgresql.jar to the IDEClassPath entry in JBuilder.ini
> (C:\JBuilder\bin\JBuilder.ini) on my system.
>
> My entry reads
> IDEClassPath=..\lib\jbuilder.zip;..\lib\jbcl.zip;..\lib\jgl.zip;..\java\lib\classes.zip;..\java\lib\postgresql.jar
I checked this: the entry for postgresql.jar is already present in
JBuilder.ini.
> Then you'll have to apply a patch to the Postgresql JDBC driver. I don't
> have the changes in patch form handy, but I think they came out over the
> patches mailing list recently, so you can probably get them from the
> archive.
> It's just changing the default response of two functions in
> ResultSetMetaData.java
> to "return 0" instead of throwing an exception.
Do you know where I can get this patch ?
The site ftp://ftp.postgresql.org has been unreachable since yesterday
evening, at least from where I reside (France). I tried to browse mirror
sites but I did not find there anything such as a jdbc patch related to
Jbuilder.
> After that, I'm still at a loss as to why the update queries I send are
> never
> actually updated in the DB.
As for me, this will be the next step...
> Hope that helps a bit,
It does help, because I know at present (1) that it is possible to
connect the Jbuilder environment and Postgres and (2) that I am not
alone on the earth trying to do that !
Anyway, thanks for your reply.
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
________________________________________________________________________
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-20 19:24 Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
parent: Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
0 siblings, 1 reply; 9+ messages in thread
From: Patrick Scott Pierce @ 1998-03-20 19:24 UTC (permalink / raw)
To: Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>; +Cc: Aaron Dunlop <dunlopa@adscomputers.com>; pgsql-questions@postgreSQL.org; pgsql-interfaces
You did use it '-i' switch in starting postmaster, right? (sorry if you
have already gone through that one).
Also, I don't use the user and password fields but instead supply it in
the URL, like so:
jdbc:postgresql://some.domain.somewhere.com/database?user=postgres&password=something&auth=password
skip Username and Password and put 'postgresql.Driver' in Driver Class.
It does work and Aaron has made some head way with the updates. We now
just can't update 'DATE' types.
Patrick Scott Pierce
pspierce@mindspring.com
CGI Programming
Mindspring Enterprises
On Fri, 20 Mar 1998, Pierre Habraken wrote:
> Date: Fri, 20 Mar 1998 14:45:27 +0100
> From: Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
> To: Aaron Dunlop <dunlopa@adscomputers.com>
> Cc: pgsql-questions@postgreSQL.org, pgsql-interfaces@postgreSQL.org
> Subject: Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
>
> Aaron Dunlop wrote:
> >
> > I've gotten JDBC connections from JBuilder, but only queries - no
> > updates.
> >
> > To get the connection to work from within the IDE (e.g. when the
> > application is not actually running) you have to add the path to
> > postgresql.jar to the IDEClassPath entry in JBuilder.ini
> > (C:\JBuilder\bin\JBuilder.ini) on my system.
> >
> > My entry reads
> > IDEClassPath=..\lib\jbuilder.zip;..\lib\jbcl.zip;..\lib\jgl.zip;..\java\lib\classes.zip;..\java\lib\postgresql.jar
>
> I checked this: the entry for postgresql.jar is already present in
> JBuilder.ini.
>
>
> > Then you'll have to apply a patch to the Postgresql JDBC driver. I don't
> > have the changes in patch form handy, but I think they came out over the
> > patches mailing list recently, so you can probably get them from the
> > archive.
> > It's just changing the default response of two functions in
> > ResultSetMetaData.java
> > to "return 0" instead of throwing an exception.
>
> Do you know where I can get this patch ?
> The site ftp://ftp.postgresql.org has been unreachable since yesterday
> evening, at least from where I reside (France). I tried to browse mirror
> sites but I did not find there anything such as a jdbc patch related to
> Jbuilder.
>
>
> > After that, I'm still at a loss as to why the update queries I send are
> > never
> > actually updated in the DB.
>
> As for me, this will be the next step...
>
>
> > Hope that helps a bit,
>
> It does help, because I know at present (1) that it is possible to
> connect the Jbuilder environment and Postgres and (2) that I am not
> alone on the earth trying to do that !
>
> Anyway, thanks for your reply.
>
> 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
> ________________________________________________________________________
> --
> Official WWW Site: http://www.postgresql.org
> Online Docs & FAQ: http://www.postgresql.org/docs
> Searchable Lists: http://www.postgresql.org/mhonarc
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-21 10:04 Peter T Mount <postgresdev@maidast.demon.co.uk>
parent: Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
0 siblings, 1 reply; 9+ messages in thread
From: Peter T Mount @ 1998-03-21 10:04 UTC (permalink / raw)
To: Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>; +Cc: Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>; Aaron Dunlop <dunlopa@adscomputers.com>; pgsql-questions@postgresql.org; pgsql-interfaces
On Fri, 20 Mar 1998, Patrick Scott Pierce wrote:
> You did use it '-i' switch in starting postmaster, right? (sorry if you
> have already gone through that one).
>
> Also, I don't use the user and password fields but instead supply it in
> the URL, like so:
> jdbc:postgresql://some.domain.somewhere.com/database?user=postgres&password=something&auth=password
the auth parameter is no longer valid for the 6.3 driver, as the backend
now supplies this information on connection.
--
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
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-21 15:59 Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
parent: Peter T Mount <postgresdev@maidast.demon.co.uk>
0 siblings, 0 replies; 9+ messages in thread
From: Patrick Scott Pierce @ 1998-03-21 15:59 UTC (permalink / raw)
To: Peter T Mount <postgresdev@maidast.demon.co.uk>; +Cc: Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>; Aaron Dunlop <dunlopa@adscomputers.com>; pgsql-questions@postgreSQL.org; pgsql-interfaces
Can't speak for what is happenning on the backend but I know that w/out
the auth param I was constantly greeted w/ a dialog box to input my
password and userid whether it was in the URL or not. And then it would
never accept it.
Patrick Scott Pierce
pspierce@mindspring.com
CGI Programming
Mindspring Enterprises
On Sat, 21 Mar 1998, Peter T Mount wrote:
> Date: Sat, 21 Mar 1998 10:04:55 +0000 (GMT)
> From: Peter T Mount <postgresdev@maidast.demon.co.uk>
> To: Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
> Cc: Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>,
> Aaron Dunlop <dunlopa@adscomputers.com>,
> pgsql-questions@postgreSQL.org, pgsql-interfaces@postgreSQL.org
> Subject: Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
>
> On Fri, 20 Mar 1998, Patrick Scott Pierce wrote:
>
> > You did use it '-i' switch in starting postmaster, right? (sorry if you
> > have already gone through that one).
> >
> > Also, I don't use the user and password fields but instead supply it in
> > the URL, like so:
> > jdbc:postgresql://some.domain.somewhere.com/database?user=postgres&password=something&auth=password
>
> the auth parameter is no longer valid for the 6.3 driver, as the backend
> now supplies this information on connection.
>
> --
> 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
>
> --
> Official WWW Site: http://www.postgresql.org
> Online Docs & FAQ: http://www.postgresql.org/docs
> Searchable Lists: http://www.postgresql.org/mhonarc
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-24 19:41 Peter T Mount <postgresdev@maidast.demon.co.uk>
0 siblings, 1 reply; 9+ messages in thread
From: Peter T Mount @ 1998-03-24 19:41 UTC (permalink / raw)
To: Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>; +Cc: pgsql-interfaces
On Tue, 24 Mar 1998, Patrick Scott Pierce wrote:
> It would seem that the Timestamp in the getTimestamp method in
> ResultData.java is adding three hours to the time. I hacked it up and
> simply parsed up what was coming in, created a new Timestamp and it still
> added one hour. I then subtract a single hour but this is not the best
> solution although it works and I can now save Timestamps back to the
> database.
I have come across this before. If you look at the driver source, you'll
see a hack which adds a day when creating a Date object. It's caused by an
obscure bug in the JDK (seen it in 1.1.3 & 1.1.5)
> PS. This thread should probably move over to the interfaces list.
Good idea.
--
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
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-25 23:40 Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
parent: Peter T Mount <postgresdev@maidast.demon.co.uk>
0 siblings, 1 reply; 9+ messages in thread
From: Patrick Scott Pierce @ 1998-03-25 23:40 UTC (permalink / raw)
To: Peter T Mount <postgresdev@maidast.demon.co.uk>; +Cc: pgsql-interfaces
Peter,
In case anyone ask:
Here is what I did to ResultSet.java to get the proper Timestamp:
public Timestamp getTimestamp(int columnIndex) throws SQLException
{
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzz");
df.setTimeZone(TimeZone.getDefault());
String s = getString(columnIndex);
if (s != null)
{
try {
java.util.Date d = df.parse(s);
return new Timestamp(d.getTime());
} catch (ParseException e) {
throw new SQLException("Bad Timestamp Format: at " +
e.getErrorOffset() + "
in " + s);
}
}
return null; // SQL NULL
}
It allows me to update Timestamp on jbuilder. I don't know what the
ramifications are elsewhere.
I never did look into the authorization wierdness. Frankly, it works and
I don't have time to figure out why ;) I did some stuff to getDate to get
it to work for me as well if anyone has a problem. I don't know how much
of this would effect people not using jbuilder so it may be a moot point.
Patrick Scott Pierce
pspierce@mindspring.com
CGI Programming
Mindspring Enterprises
On Tue, 24 Mar 1998, Peter T Mount wrote:
> Date: Tue, 24 Mar 1998 19:41:53 +0000 (GMT)
> From: Peter T Mount <postgresdev@maidast.demon.co.uk>
> To: Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
> Cc: pgsql-interfaces@postgreSQL.org
> Subject: Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
>
> On Tue, 24 Mar 1998, Patrick Scott Pierce wrote:
>
> > It would seem that the Timestamp in the getTimestamp method in
> > ResultData.java is adding three hours to the time. I hacked it up and
> > simply parsed up what was coming in, created a new Timestamp and it still
> > added one hour. I then subtract a single hour but this is not the best
> > solution although it works and I can now save Timestamps back to the
> > database.
>
> I have come across this before. If you look at the driver source, you'll
> see a hack which adds a day when creating a Date object. It's caused by an
> obscure bug in the JDK (seen it in 1.1.3 & 1.1.5)
>
> > PS. This thread should probably move over to the interfaces list.
>
> Good idea.
>
> --
> 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
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC
@ 1998-03-27 17:46 Peter T Mount <postgresdev@maidast.demon.co.uk>
parent: Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
0 siblings, 0 replies; 9+ messages in thread
From: Peter T Mount @ 1998-03-27 17:46 UTC (permalink / raw)
To: Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>; +Cc: pgsql-interfaces
On Wed, 25 Mar 1998, Patrick Scott Pierce wrote:
> Peter,
>
> In case anyone ask:
>
> Here is what I did to ResultSet.java to get the proper Timestamp:
> public Timestamp getTimestamp(int columnIndex) throws SQLException
> {
> SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:sszzz");
> df.setTimeZone(TimeZone.getDefault());
> String s = getString(columnIndex);
> if (s != null)
> {
> try {
> java.util.Date d = df.parse(s);
> return new Timestamp(d.getTime());
> } catch (ParseException e) {
> throw new SQLException("Bad Timestamp Format: at " +
> e.getErrorOffset() + "
> in " + s);
> }
> }
> return null; // SQL NULL
> }
>
> It allows me to update Timestamp on jbuilder. I don't know what the
> ramifications are elsewhere.
I'm working on the driver this weekend, so I'll test it out then.
> I never did look into the authorization wierdness. Frankly, it works and
> I don't have time to figure out why ;) I did some stuff to getDate to get
> it to work for me as well if anyone has a problem. I don't know how much
> of this would effect people not using jbuilder so it may be a moot point.
I'll be interested in seeing any changes that you made to get you working.
--
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
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~1998-03-27 17:46 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-03-18 19:00 Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC Peter T Mount <postgresdev@maidast.demon.co.uk>
1998-03-19 13:16 ` Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
1998-03-20 13:45 Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC Pierre Habraken <Pierre.Habraken@ujf-grenoble.fr>
1998-03-20 19:24 ` Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
1998-03-21 10:04 ` Peter T Mount <postgresdev@maidast.demon.co.uk>
1998-03-21 15:59 ` Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
1998-03-24 19:41 Re: [QUESTIONS] Accessing Postgresfrom JBuilder using JDBC Peter T Mount <postgresdev@maidast.demon.co.uk>
1998-03-25 23:40 ` Patrick Scott Pierce <pspierce@slacker.design.mindspring.net>
1998-03-27 17:46 ` Peter T Mount <postgresdev@maidast.demon.co.uk>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox