if your application is web application then :-

In web.xml add the following lines:-

<resource-ref >
<res-ref-name>jdbc/MyDSName</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

In the C:\jboss-3.2.2\server\YourApp\deploy , you must create the 
postgres-ds.xml file :

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->

<!-- $Id: postgres-ds.xml,v 1.1.2.1 2003/09/05 16:38:24 patriot1burke Exp $ -->



<local-tx-datasource>
<jndi-name>PostgresDS</jndi-name>
<connection-url>jdbc ostgresql://yourserver ort/appcontext</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<user-name>user</user-name>
password

<!-- sql to call when connection is created
<new-connection-sql>some arbitrary sql</new-connection-sql>
-->

<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->

</local-tx-datasource>



And finally, you have to create a jboss-web.xml in your WEB-INF app directory 
as follows :


<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/MyDSName</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:/PostgresDS</jndi-name>
</resource-ref>
</jboss-web>

Then , in order to get the DS object, you have this code (using JNDI) :

ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/MyDSName");




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

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


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to