This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes connecting to postgresql Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "connecting to postgresql" Watch "connecting to postgresql" New topic
Author

connecting to postgresql

Simon Simbolon
Greenhorn

Joined: Apr 15, 2010
Posts: 5
Please help.

Does anyone knows how to connect Java Apps to PostgreSQL using a class that implements javax.sql.DataSource?
I also needed the class to be able to accept jdbc url (eg. jdbc:postgresql://localhost/mydatabase) as input.
I'm currently working with a legacy system that kinda restrict connection with that condition.

I tried googling but can't seem to find class that support that condition.

Please help?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26193
    
  66

Simon,
I don't follow. Does the class supplied with the postgresql driver not do that?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Simon Simbolon
Greenhorn

Joined: Apr 15, 2010
Posts: 5
Sorry for not being clear,

What I meant is that I needed a class in postgresql jdbc, I'm currently using postgresql-9.0-801.jdbc4.jar, that implement javax.sql.DataSource, so that I can get connection with code similar to this:



I've tried googling, but every class I found that implement javax.sql.DataSource, such as org.postgresql.ds.PGSimpleDataSource, can't take url as its input
So, any suggestion?

Thanks in advance
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: connecting to postgresql
 
Similar Threads
Two systems on one tomcat 6 server.
photo upload using jsp
JDBC Connection pooling in postgresql
PostgreSql Connection Error:
read data from excel sheet and put it into the postgresql database