Skip site navigation (1) Skip section navigation (2)

Re: Problem in connecting to database

From: Deepak <mail(dot)dktyagi(at)gmail(dot)com>
To: Rekha Ravi Pai <rekha(at)softjin(dot)com>
Cc: pgsql-in-general(at)postgresql(dot)org
Subject: Re: Problem in connecting to database
Date: 2010-11-08 11:40:17
Message-ID: AANLkTi=90p+790cczAbGnqQJFwAvyDxgp8Sp8uiVGx35@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-in-general
Hi Rekha,

jdbc:postgresql://*localhost*/postgres?user=postgres&password=postgres"

From the code it seems that your Postgres database is running on the same
server on which application is running.a

1. check if Postgres database is running.
2. Telnet IP & Port like telnet localhost 5432.
3. In your code you should also mention Port of Postgres.
jdbc:postgresql://*localhost*
/postgres?user=postgres&password=postgres;Port=5432"

Please see the exact syntax in google for mentioning Port.

Hope this will help.

Regards,
Deepak

On Mon, Nov 8, 2010 at 2:00 PM, Rekha Ravi Pai <rekha(at)softjin(dot)com> wrote:

>  Hi,
> I have installed postgresql 9.0 and tomcat 6.0.
> I created the jsp page given below.
>
> ---------------------------------------------------------------------------------------------------
> <html>
> <head>
> </head>
> <%@ page language="java" import="java.sql.*, beans.*" %>
> <%!
> Connection myConn=null;
> %>
> <body>
> <%
> //PasswordEncryptService p = new PasswordEncryptService();
> try{
> Class.forName("org.postgresql.Driver").newInstance();
>
> myConn=DriverManager.getConnection("jdbc:postgresql://localhost/postgres?user=postgres&password=postgres");
> out.println("myConn :"+myConn.toString());
> }catch(Exception e){
>     out.println(e.toString());
> }
> out.println("myConn :");
> %>
> <B>Done</B>
> </body>
> </html>
>
> -------------------------------------------------------------------------------------------------------------------------------
> On running the web page I am getting the following error.
> org.postgresql.util.PSQLException: Connection refused. Check that the
> hostname and port are correct and that the postmaster is accepting TCP/IP
> connections.
>
> Can anybody help me in this regard?
>
> Regards,
> Rekha
>
> Business Disclaimer
> ____________________________________________________________
> This e-mail message and any files transmitted with it are intended solely
> for  the use  of the  individual or entity  to which they  are  addressed. It
> may  contain confidential,  proprietary or legally  privileged  information.
> If  you  are  not  the  intended recipient please be advised that you have
> received  this  message in error and any use is strictly prohibited. Please
> immediately  delete it  and all copies of it from your system, destroy any
> hard  copies  of  it and  notify  the  sender  by return mail. You must not,
> directly or indirectly, use,  disclose,  distribute, print, or copy any part of
> this message if you are not the intended recipient.
> ___________________________________________________________
>
>

In response to

pgsql-in-general by date

Next:From: Rekha Ravi PaiDate: 2010-11-09 05:23:21
Subject: [Fwd: Re: Problem in connecting to database]
Previous:From: sαbαяiиαŧЋαи IyєяDate: 2010-11-08 11:25:28
Subject: Re: Problem in connecting to database

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group