954,574 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How do I access a PostgreSQL DB?

I just got a JSP hosting account and I'm wondering how I can connect to the PostgreSQL DB and execute queries. According to the host's FAQ, the database URL is:
jdbc:postgresql://localhost/username,username,password
.

mmiikkee12
Posting Whiz in Training
274 posts since Oct 2004
Reputation Points: 17
Solved Threads: 5
 

You don't access databases through JSP. JSP comes paired up with servlets written in Java. The servlets (and underlying classes) does all the heavy work, while the JSPs just view the results.

keibi
Newbie Poster
9 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

You can't just do it with

<%
DB access code here
%>

?

mmiikkee12
Posting Whiz in Training
274 posts since Oct 2004
Reputation Points: 17
Solved Threads: 5
 

No idea, I never tried. I manage my database connections with Hibernate (persistence framework), and put only view code in the jsp's.

keibi
Newbie Poster
9 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

Anyway, what's the Java code for accessing the DB?

mmiikkee12
Posting Whiz in Training
274 posts since Oct 2004
Reputation Points: 17
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You