4 Replies Latest reply on Jan 3, 2007 10:34 PM by Colin Goudie

    Looking up Datasource from Client

    Colin Goudie Newbie

      I have a client app and want to access the JDBC connection to use Jasperreports from the client.

      One way would be to configure the client with its own database settings that are just duplicated in my ...-ds.xml file.

      Instead I have heard you can do a JNDI lookup to retrieve a Datasource object? Can anyone give me any tips on what the JNDI name is for the datasource with the settings below? (Running jboss-4.0.5.GA)

      persistence.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence>
       <persistence-unit name="pos-em">
       <jta-data-source>java:/PostgresDS</jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="update"/>
       </properties>
       </persistence-unit>
      </persistence>


      postgres-ds.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>PostgresDS</jndi-name>
       <connection-url>jdbc:postgresql://127.0.0.1:5432/posejb3</connection-url>
       <driver-class>org.postgresql.Driver</driver-class>
       <user-name>postgres</user-name>
       <password>password</password>
       <metadata>
       <type-mapping>PostgreSQL 8.0</type-mapping>
       </metadata>
       </local-tx-datasource>
      </datasources>


      thanks