Hi Raj

While I'm not using Postgresql (MySQL instead) there were a couple of things I 
noticed 
that you might need to check:

1. You have specified the data source entry in your Struts-config.xml - on my 
Tomcat 
5.0 I need to enter this in the META-INF/context.xml   (I have more on this if 
you need 
it, Tomcat 5.0 and 5.5 differ in where they look for the Data Source parameters)

2. The other thing is to ensure you have your Postgresql JDBC jar file added to 
your 
Tomcat common/lib

Kind regards
mc


On 8 Sep 2005 at 4:11, R Rajendran wrote:

> Hi,
>  
> When I connect Struts to Postgresql 8.0 database using DataSource object I 
> get the 
following error messages:
>  
> Source:
>  
> DataSource dataSource = null;
>     
>     try {
>     dataSource = getDataSource(request);
>     conn = dataSource.getConnection();
>     
>     /* working 
>     Class.forName("org.postgresql.Driver");
>    conn = 
DriverManager.getConnection("jdbc:postgresql://192.168.1.22:5432/omsdb","postgres","
postgres");
>    */
>      
>     stmt = conn.createStatement();
>    String sql = "select * from stocks where "
>         + "symbol ='" + symbol + "'";
>     rs = stmt.executeQuery("select * from stocks where "
>         + "symbol ='" + symbol + "'"); 
> }catch(){..}
> ************************************************* 
> struts-config.xml:
>  
> <data-source type="org.postgresql.jdbc2.optional.SimpleDataSource">
> 
> <set-property property="driverClassName"
> 
> value="org.postgresql.Driver" />
> 
> <set-property property="url"
> 
> value="jdbc:postgresql://192.168.1.22:5432/omsdb" />
> 
> <set-property property="username"
> 
> value="postgres" />
> 
> <set-property property="password"
> 
> value="postgres" />
> 
> </data-source> 
> 
> *****************************************************
>  
>  
>  
> I am getting the following error message while running the struts application:
>  
> INFO: Failed to create a non-pooled connection for null at 
jdbc:postgresql://localhost/null?prepareThreshold=0: 
org.postgresql.util.PSQLException: Connection refused. Check that the hostname 
and 
port are correct and that the postmaster is accepting TCP/IP connections.
> 
> Connection refused. Check that the hostname and port are correct and that the 
postmaster is accepting TCP/IP connections.
> 
> Could anyone tell me how to resolve this issue.
>  
>  
> Thanks
> Raj
> 
> 
> 
> 
> 
>  
> 
> 



FOCUS Computing
Mob: 0415 24 26 24
[EMAIL PROTECTED]
http://www.focus-computing.com.au



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.10.19/93 - Release Date: 8/09/2005


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to