Re: jsp postgresql problems - Mailing list pgsql-jdbc

From Joe Shevland
Subject Re: jsp postgresql problems
Date
Msg-id HEECIHEEJDBMCCGMGIOBOEGLCFAA.jshevland@j-elite.com
Whole thread Raw
In response to jsp postgresql problems  ("Ryan Skoblenick" <webmaster@skoblenick.com>)
List pgsql-jdbc
JSP (any Java) will use TCP/IP via the driver... you may need to tweak
your pg_hba.conf file to allow TCP/IP connections from localhost, or add
the -i flag when starting postmaster up as this enables the server socket.

Cheers,
Joe

PS You can omit the port number 5432 from the connection string as this is
the default, even 'jdbc:postgresql:db_name' will work for local
connections (and as Nick mentioned you don't need the newInstance()
method, drivers you do need it for are breaking the spec).

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org]On Behalf Of Ryan Skoblenick
Sent: Monday, 4 March 2002 10:52
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] jsp postgresql problems


This is my code:
<%@ page import ="java.sql.*" %>
<%
Driver drv = (Driver)Class.forName("org.postgresql.Driver").newInstance();
Connection conn =
java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5432/db_
name", "username", "password");
%>
now the stack error i am running into is:
Connection refused. Check that the hostname and port is correct, and that
the postmaster is running with the -i flag, which enables TCP/IP
networking.
i know its not the server or the way it is setup cause i can connect to
the DB in ASP? so what is wrong with the JSP? i do have the drivers
installed for postgresql cause the first error before this i was getting
was that it couldn't find the drivers (silly me forgot to reset the
server).
anyone help ?
Thanks

Attachment

pgsql-jdbc by date:

Previous
From: "adr rrp pub"
Date:
Subject: PostgreSQL and MacOS X
Next
From: "Joe Shevland"
Date:
Subject: Re: PostgreSQL and MacOS X