Database Connection

T

thammerlund

Hi everyone,

I'm just starting to learn JAVA/JSP, and I'm at the point where I'm
trying to connect to a PostgreSQL 8.1 database through Tomcat 5.5, but
I'm not having any success. My Page code is as follows:

<html>
<head>
</head>
<%@ page language="java" import="java.sql.*" %>

<body>

<%

public Statement dbStatement;

dbStatement = dbConnection.createStatement();


Class.forName("org.postgresql.Driver");

Connection
myConn=DriverManager.getConnection("jdbc:postgresql://localhost/PostgreDB?user=postgres&password=postgres");



Conn = setDbConnection(PostgreDB)


%>
</html>

Is there something wrong with the code, or is it the web.xml or
server.xml file? I put the postgresql-8.1-405.jdbc3.jar file in
WEB-INF/lib.

Thank you,
Tom
 
J

Jon Martin Solaas

thammerlund said:
I'm not having any success.

What exactly makes you think you don't have any success? Is there an
error message perhaps? Surely the webpage doesn't output anything ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top