Re: Problem in connecting to database

Lists: pgsql-in-general
From: Rekha Ravi Pai <rekha(at)softjin(dot)com>
To: pgsql-in-general(at)postgresql(dot)org
Subject: Problem in connecting to database
Date: 2010-11-08 08:30:06
Message-ID: 4CD7B50E.2090109@softjin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-in-general

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
I have installed postgresql 9.0 and tomcat 6.0.<br>
I created the jsp page given below.<br>
---------------------------------------------------------------------------------------------------<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;/head&gt;<br>
&lt;%@ page language="java" import="java.sql.*, beans.*" %&gt;<br>
&lt;%!<br>
Connection myConn=null;<br>
%&gt;<br>
&lt;body&gt;<br>
&lt;%<br>
//PasswordEncryptService p = new PasswordEncryptService();<br>
try{<br>
Class.forName("org.postgresql.Driver").newInstance();<br>
myConn=DriverManager.getConnection("jdbc:postgresql://localhost/postgres?user=postgres&amp;password=postgres");<br>
out.println("myConn :"+myConn.toString());<br>
}catch(Exception e){<br>
&nbsp;&nbsp;&nbsp; out.println(e.toString());<br>
}<br>
out.println("myConn :");<br>
%&gt;<br>
&lt;B&gt;Done&lt;/B&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
-------------------------------------------------------------------------------------------------------------------------------<br>
On running the web page I am getting the following error.<br>
<font color="#ff0000">org.postgresql.util.PSQLException: Connection
refused. Check that the
hostname and port are correct and that the postmaster is accepting
TCP/IP connections.</font><br>
<br>
Can anybody help me in this regard?<br>
<br>
Regards,<br>
Rekha<br>
<pre>

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.
___________________________________________________________
</pre></body>
</html>

Attachment Content-Type Size
unknown_filename text/html 2.2 KB

From: Sachin Srivastava <sachin(dot)srivastava1984(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 09:10:29
Message-ID: C915C068-5D33-4889-B47B-0BB7EDB8325A@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-in-general

Hello,
On Nov 8, 2010, at 2:00 PM, Rekha Ravi Pai 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.
Is your PG Server running on port 5432 (default)?
>
> 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.
> ___________________________________________________________

--
Regards,
Sachin Srivastava


From: sαbαяiиαŧЋαи Iyєя <sabari(dot)us(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:25:28
Message-ID: AANLkTikJD-fj1kXpMo3SNaZ0ynxNtuwmAeeWKT58OxNV@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-in-general

Dear Rekha,
Itseems that from your page your unable to connect Postgres server ,try
checking with telnet with hostname and port ...

--
Best Regards and Thanks,
S.Sabarinathan .

On 8 November 2010 14:00, 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.
> ___________________________________________________________
>
>


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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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.
> ___________________________________________________________
>
>