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

Re: JNDI Datasource in tomcat

From: Ingmar Lötzsch <iloetzsch(at)asci-systemhaus(dot)de>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JNDI Datasource in tomcat
Date: 2008-11-04 13:19:19
Message-ID: 49104BD7.3090104@asci-systemhaus.de (view raw or flat)
Thread:
Lists: pgsql-jdbc
Hello,

what is dbSessionConfig?

What SQL-Statement ist executed?

Did you try PreparedStatement.execute() instead of
PreparedStatement.executeUpdate()?

Ingmar

> Hi
>         
>         Im trying to get a connection through a JNDI service in tomcat.
>         Im
>         trying wuth this config.
>         
>         <Resource
>                 auth="Container"
>                 name="jdbc/openbravo"
>                 type="org.postgresql.jdbc3.Jdbc3SimpleDataSource"
>                 driverClassName="org.postgresql.Driver"
>                 password="postgres"
>                 maxIdle="5"
>                 maxWait="10000"
>                 user="postgres"
>                 maxActive="20" 
>                 databaseName="openbravo"
>                 serverName="127.0.0.1"
>                 portNumber="5432"
>                 factory="org.postgresql.jdbc3.Jdbc3ObjectFactory"/>
>         
>         using thi driver. pg74.216.jdbc3.jar 
>         I get this error 
>         - org.postgresql.util.PSQLException: A result was returned when
>         none was
>         expected.
>         - Unable to create a connection pool
>         org.openbravo.exception.PoolNotFoundException: Failed when
>         creating
>         database connections pool: org.postgresql.util.PSQLException: A
>         result
>         was returned when none was expected.
>         
>         Here
>          Context initctx = new InitialContext();
>          Context ctx = (Context) initctx.lookup("java:/comp/env");
>          DataSource ds = (DataSource) ctx.lookup(jndiResourceName);
>         con = ds.getConnection();
>         -- Here i get a org.postgresql.jdbc3.connectionjdbc3
>          PreparedStatement pstmt =
>         con.prepareStatement(dbSessionConfig);
>         pstmt.executeUpdate();  <--- Here a got the error
>         
>         when i used the driver manager with this driver
>         jdbc3-postgresql.jar i
>         think that i got another kind of connection and i havent got no
>         error.
>         seems that now i have a config error but i dont really know
>         whats the
>         correct way to fix it
>         
>         can someone help me 
>         
>         Thanks and regards


In response to

pgsql-jdbc by date

Next:From: SangeetaDate: 2008-11-04 15:46:05
Subject: Retrieve auto-generated key.
Previous:From: Gorka MauleonDate: 2008-11-04 08:16:12
Subject: JNDI Datasource in tomcat

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