mkngau
asked on
Webapp with postgresql
Hi,
I have set up my postgresql in a linux RH7.0 machine. And my Tomcat webapp is on a NT mechine.
I have test the postmaster..it runs well. And same to the tomcat.
My question is how can I establish the JDBC connection from Tomcat jsp page in Nt to the postgresql in Linux mechine?
What do i need to do?
1) where should I install the jdbc driver? Nt or Linux?
2) how to set the port for the database?
Thanks.
I have set up my postgresql in a linux RH7.0 machine. And my Tomcat webapp is on a NT mechine.
I have test the postmaster..it runs well. And same to the tomcat.
My question is how can I establish the JDBC connection from Tomcat jsp page in Nt to the postgresql in Linux mechine?
What do i need to do?
1) where should I install the jdbc driver? Nt or Linux?
2) how to set the port for the database?
Thanks.
Oops. Botched the previous code. The 8080 should read 5432, of course...
--Steve
--Steve
ASKER
hi steve,
thanks for the help. But, do I need to make changes in the pg_hba.conf ?
thanks for the help. But, do I need to make changes in the pg_hba.conf ?
ASKER
hi,
I'm using postgres 7.1.2 so which jdbc driver is suitable for me? where can I get it?
The error message is
ClassNotFoundException: Unable to load class postgresql.Driver SQLException: No suitable driver
I'm using postgres 7.1.2 so which jdbc driver is suitable for me? where can I get it?
The error message is
ClassNotFoundException: Unable to load class postgresql.Driver SQLException: No suitable driver
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks steve,
Thank you for your help. I have solved my problem.
Thank you for your help. I have solved my problem.
2) The default port for postgres is 5432. Assuming you haven't changed the default, this is the port to use. To connect from your JSP page:
.
.
.
String db = new String("jdbc:postgresql://
String usr = new String("username");
String pwd = new String("password");
Class.forName("org.postgre
// Load database interface
Connection conn =
DriverManager.getConnectio
.
.
.
HTH.
--Steve