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

Problem in connecting to database

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 (view raw or flat)
Thread:
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: unknown_filename
Description: text/html (2.2 KB)

Responses

pgsql-in-general by date

Next:From: Sachin SrivastavaDate: 2010-11-08 09:10:29
Subject: Re: Problem in connecting to database
Previous:From: Tamayo, Damian-p65828Date: 2009-07-08 15:43:12
Subject: Unnest() and xml

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