I modify the db2-ds.xml file and put it in server/default/deploy folder.The file is
<?xml version="1.0" encoding="UTF-8"?>
<!-- ===================================================================== -->
<!-- -->
<!-- JBoss Server Configuration -->
<!-- -->
<!-- ===================================================================== -->
<!-- $Id: db2-ds.xml 43824 2006-04-16 21:48:44Z wprice $ -->
<datasources>
<local-tx-datasource>
<jndi-name>test</jndi-name>
<connection-url>jdbc:db2://localhost:50000/dbinventory</connection-url>
<!-- DB2 Universal Driver Note connection URL is in form of
jdbc:db2://host:port:dbname
Default port for Type 4 driver is 50000
Note, host and port must be specified if using Type 4 driver. And be forewarned, no native
XA support is provided with Type 4; you must set a DB property calling for Type 2 to get XA
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
<connection-url>jdbc:db2://[hostname]:[port]/databasename"</connection-url>
Please see
http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0512kokkat/
or the DB2 JDBC application developers manual.
-->
<driver-class>COM.ibm.db2.jdbc.app.DB2Driver</driver-class>
<user-name>admin</user-name>
<password>admin</password>
<min-pool-size>0</min-pool-size>
<max-pool-size>50</max-pool-size>
<!-- New org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.DB2ExceptionSorter</exception-sorter-class-name>
-->
<!-- 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>
-->
<!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
<metadata>
<type-mapping>DB2</type-mapping>
</metadata>
</local-tx-datasource>
</datasources>
And in J2EE i write this code
try
{
ic=new javax.naming.InitialContext();
ds=(javax.sql.DataSource)ic.lookup("test");
conn=ds.getConnection();
}
catch(Exception e)
{
System.out.println("Error in DBConnection "+e.getMessage());
}
But i got this error Message:- Error in DBConnection test not bound
I have to do any more changes?Why this error??Somebody please help......
thanks in advance....