1 Reply Latest reply on Sep 17, 2004 9:03 AM by khkachn

    Multible Postgres DBs and DS - I get connection to wrong DB

    khkachn

      Hi,

      I am using JBoss 3.2.3 and Postgres 7.3.4 with the JDBC jar
      from postgres in JBoss server/default/lib. This is on a IRIX64/6.5
      system with Java 1.4.1_06, if that matters.

      I have two databases created in Postgres and two -ds.xml files
      deployed. I do a JNDI lookup of the DataSources and get the
      connection from them. Much of the time both connections
      are to the same database (I print some MetaData info on error)
      and I get 'Resource not found' errors. Sometimes it works fine.

      I made a Java test application that connects to the databases
      using the same JVM, postgresql.jar and database URLs and it
      works correctly everytime.

      Any idea's what I could try or if this is even a JBoss issue?

      Thanks,




      <jndi-name>Proj1PostgresDS</jndi-name>
      <connection-url>
      jdbc:postgresql://localhost:5432/dbName1
      </connection-url>
      <driver-class>org.postgresql.Driver</driver-class>
      <user-name>YYY</user-name>
      XXX
      <new-connection-sql>
      select 1 from TABLE1 where 1=2
      </new-connection-sql>
      <check-valid-connection-sql>
      select 1 from TABLE1 where 1=2
      </check-valid-connection-sql>
      </local-tc-datasource>



      <jndi-name>PostgresDS</jndi-name>
      <connection-url>
      jdbc:postgresql://localhost:5432/dbName2
      </connection-url>


      Rest is basicly the same with different user and TABLE name.
      I could not figure out how to get the password to show right,
      thats the XXX line.