Pooled Data Source
imcdermid Oct 25, 2002 8:31 PMI am having great trouble getting a pooled data source to work.
when Jboss starts up, i see the following message on the screen:
[INFO,myOracleDS] Starting
[INFO,myOracleDS] XA Connection pool myOracleDS bound to java:/myOracleDS
[INFO,myOracleDS] Started
I have setup an mbean in jboss.jcml
myOracleDS
org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
jdbc:oracle:oci8:@oralin
beg
10
java
false
false
false
true
120000
1800000
false
false
1.0
0
When I run the code I get the following error:
Something Failed: myOracleDS not bound
javax.naming.NameNotFoundException: myOracleDS not bound
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:349)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at DSConnect.main(DSConnect.java:26)
the source code is:
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import java.util.*;
public class DSConnect {
public static void main(String[] args) throws Exception {
try {
//setup initial context
Properties env = new Properties();
env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.provider.url", "localhost:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
//get Initial context
InitialContext ic = new InitialContext(env);
//lookup Datasource
ConnectionPoolDataSource ds = (ConnectionPoolDataSource)ic.lookup("java:/myOracleDS");
//Get Connection
PooledConnection pc = ds.getPooledConnection();
Connection conn = pc.getConnection();
conn.close();
}
catch(Exception e) {
System.out.println("Something Failed: " + e.getMessage());
e.printStackTrace();
}
}
}
Can anyone please tell me what is wrong
Tks