pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feedEmbedding Postgres in Java Application
6+ messages / 5 participants
[nested] [flat]
* Embedding Postgres in Java Application
@ 2005-01-16 16:20 Jasper Potts <jasper@squarepark.com>
0 siblings, 2 replies; 6+ messages in thread
From: Jasper Potts @ 2005-01-16 16:20 UTC (permalink / raw)
To: pgsql-jdbc
I am developing a desktop GUI application and am using postgres 8. I
need to be able to embed/bundle postgres with my application. To start
with I am releasing on windows with Linux and OSX later.
Is there a way of creating a JDBC connection to the db not over a
network socket?
The other way is going to be to start/stop the database from Java by
calling "pg_ctl start/stop". But that issues with this because of the
windows restrictions that postgres can't be run as a user with admin
privileges. Any Ideas?
Many Thanks
Jasper Potts
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Embedding Postgres in Java Application
@ 2005-01-16 16:32 Kris Jurka <books@ejurka.com>
parent: Jasper Potts <jasper@squarepark.com>
1 sibling, 1 reply; 6+ messages in thread
From: Kris Jurka @ 2005-01-16 16:32 UTC (permalink / raw)
To: Jasper Potts <jasper@squarepark.com>; +Cc: pgsql-jdbc
On Sun, 16 Jan 2005, Jasper Potts wrote:
> Is there a way of creating a JDBC connection to the db not over a
> network socket?
No. Java does not have support for unix sockets.
> The other way is going to be to start/stop the database from Java by
> calling "pg_ctl start/stop". But that issues with this because of the
> windows restrictions that postgres can't be run as a user with admin
> privileges. Any Ideas?
>
Even if Java did support unix sockets you would still have to start the
server running. PostgreSQL is not designed to be an embedded database
(especially not by Java). This doesn't seem like a great idea, perhaps
one of the Java databases would be more appropriate for this task?
Kris Jurka
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Embedding Postgres in Java Application
@ 2005-01-16 16:41 Jasper Potts <jasper@squarepark.com>
parent: Kris Jurka <books@ejurka.com>
0 siblings, 0 replies; 6+ messages in thread
From: Jasper Potts @ 2005-01-16 16:41 UTC (permalink / raw)
To: pgsql-jdbc
I have tested most of the other options Hypersonic, Firebird, Daffodil
and Postgres is much faster with large data sets and a lot better on
memory usage. I have not tried Cloudscape as that was only very recently
released under a license that would allow me to embed it. The query
times with Postgres are in the 1-5sec range comparing to 30sec plus on
the others. Hypersonic can be quick but only with the entire table in
memory, gets nasty with outer joins.
Are there are any I haven't tried and should be looking at?
I am using Hibernate as a middle layer so porting should not be an issue.
Thanks
Jasper
Kris Jurka wrote:
>On Sun, 16 Jan 2005, Jasper Potts wrote:
>
>
>
>>Is there a way of creating a JDBC connection to the db not over a
>>network socket?
>>
>>
>
>No. Java does not have support for unix sockets.
>
>
>
>>The other way is going to be to start/stop the database from Java by
>>calling "pg_ctl start/stop". But that issues with this because of the
>>windows restrictions that postgres can't be run as a user with admin
>>privileges. Any Ideas?
>>
>>
>>
>
>Even if Java did support unix sockets you would still have to start the
>server running. PostgreSQL is not designed to be an embedded database
>(especially not by Java). This doesn't seem like a great idea, perhaps
>one of the Java databases would be more appropriate for this task?
>
>Kris Jurka
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Embedding Postgres in Java Application
@ 2005-01-16 19:39 John R Pierce <pierce@hogranch.com>
parent: Jasper Potts <jasper@squarepark.com>
1 sibling, 1 reply; 6+ messages in thread
From: John R Pierce @ 2005-01-16 19:39 UTC (permalink / raw)
To: Jasper Potts <jasper@squarepark.com>; +Cc: pgsql-jdbc
Jasper Potts wrote:
> I am developing a desktop GUI application and am using postgres 8. I
> need to be able to embed/bundle postgres with my application. To start
> with I am releasing on windows with Linux and OSX later.
>
> Is there a way of creating a JDBC connection to the db not over a
> network socket?
not only does JDBC not support unix sockets, neither does Windows.
> The other way is going to be to start/stop the database from Java by
> calling "pg_ctl start/stop". But that issues with this because of the
> windows restrictions that postgres can't be run as a user with admin
> privileges. Any Ideas?
I'd suggest your windows installer install postgres as a system service by
cloning the operation of the standard windows installer for pgsql, and you use
localhost for your database connections. If you're using a java installer
that doesn't understand windows services, maybe you could put it in a MSI
(Microsoft Installer) wrapper that invokes both Postgres's MSI based
installation and your java installer.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Embedding Postgres in Java Application
@ 2005-01-16 20:48 Jasper Potts <jasper@jasperpotts.com>
parent: John R Pierce <pierce@hogranch.com>
0 siblings, 1 reply; 6+ messages in thread
From: Jasper Potts @ 2005-01-16 20:48 UTC (permalink / raw)
To: pgsql-jdbc
John R Pierce wrote:
>
> I'd suggest your windows installer install postgres as a system
> service by cloning the operation of the standard windows installer for
> pgsql, and you use localhost for your database connections. If
> you're using a java installer that doesn't understand windows
> services, maybe you could put it in a MSI (Microsoft Installer)
> wrapper that invokes both Postgres's MSI based installation and your
> java installer.
>
I think thats probably the way to go, at least for the Win 2000/XP
users. Any idea if Postgres 8 will work with Win 98/Me? My guess is not
from what I have seen, talk about NTFS dependencies on the general
mailing list. So will probably go for Hypersonic for those guys, as its
simple and copes well if you don't push the database too large.
Is the src for the Postgres installer available? to use as a starting point.
Thanks
Jasper
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Embedding Postgres in Java Application
@ 2005-01-16 21:55 Charlie Kelly <Charlie@CharlieKelly.com>
parent: Jasper Potts <jasper@jasperpotts.com>
0 siblings, 0 replies; 6+ messages in thread
From: Charlie Kelly @ 2005-01-16 21:55 UTC (permalink / raw)
To: ; +Cc: pgsql-jdbc
You might also consider Derby (formerly Cloudscape), which IBM
contributed via open source.
I've found Hibernate an excellent tool for development.
It has great support for postgresql and hypersonic; it is developing
support for derby.
Hibernate is an object - relational mapping tool. You write database
calls in java using "object oriented" calls without worrying about the
underlying database.
Charlie
Jasper Potts wrote:
> John R Pierce wrote:
>
>>
>> I'd suggest your windows installer install postgres as a system
>> service by cloning the operation of the standard windows installer
>> for pgsql, and you use localhost for your database connections. If
>> you're using a java installer that doesn't understand windows
>> services, maybe you could put it in a MSI (Microsoft Installer)
>> wrapper that invokes both Postgres's MSI based installation and your
>> java installer.
>>
> I think thats probably the way to go, at least for the Win 2000/XP
> users. Any idea if Postgres 8 will work with Win 98/Me? My guess is
> not from what I have seen, talk about NTFS dependencies on the general
> mailing list. So will probably go for Hypersonic for those guys, as
> its simple and copes well if you don't push the database too large.
>
> Is the src for the Postgres installer available? to use as a starting
> point.
>
> Thanks
>
> Jasper
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
>
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2005-01-16 21:55 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-16 16:20 Embedding Postgres in Java Application Jasper Potts <jasper@squarepark.com>
2005-01-16 16:32 ` Kris Jurka <books@ejurka.com>
2005-01-16 16:41 ` Jasper Potts <jasper@squarepark.com>
2005-01-16 19:39 ` John R Pierce <pierce@hogranch.com>
2005-01-16 20:48 ` Jasper Potts <jasper@jasperpotts.com>
2005-01-16 21:55 ` Charlie Kelly <Charlie@CharlieKelly.com>
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