[jboss-user] [EJB 3.0] - Looking up Datasource from Client

gommo do-not-reply at jboss.com
Wed Jan 3 20:32:22 EST 2007


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


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997781#3997781

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997781



More information about the jboss-user mailing list