Database Connection

Discussion in 'Java' started by thammerlund, Jul 7, 2006.

  1. thammerlund

    thammerlund Guest

    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
     
    thammerlund, Jul 7, 2006
    #1
    1. Advertising

  2. thammerlund wrote:

    > 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 ...
     
    Jon Martin Solaas, Jul 7, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mythran
    Replies:
    5
    Views:
    4,989
    Mythran
    Oct 5, 2005
  2. Dave Johnson

    Using Connection Class VS Connection Module

    Dave Johnson, Dec 9, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    654
    Dave Johnson
    Dec 11, 2005
  3. Linus Nikander
    Replies:
    5
    Views:
    557
  4. Replies:
    3
    Views:
    40,568
    Roedy Green
    Nov 16, 2005
  5. R
    Replies:
    1
    Views:
    587
Loading...

Share This Page