Can not get Oracle Connection NO ERRORS!
augustynr Sep 18, 2002 10:07 PMHi,
I have looked through this forum and through all docs ( I got a yearly subscription :) ) and I still can not get to get a connection from oracle.
Hope that one of you can help.
I am running JBoss and Oracle 8.1.7 on a different servers.
This is what I did so far:
1. Copy the "classes12.jar" to the "jboss/server/default/lib" catalog. (the Oracle JDBC driver)
2. Copy the "nls_charset12.jar" to the "jboss/server/default/lib" catalog. (Oralce language package)
4. Copy the "jboss/docs/examples/jca/oracle-service.xml" file into the "jboss/server/default/deploy" catalog.
5. Edit the file "jboss/server/default/deploy/oracle-service.xml":
In the "OracleRealm" block
<blabla..."UserName">yourOralceLogin</module-option>
<blabla..."password">yourOraclePass</module-option>
In the "ManagedConnectionFactoryProperties" block:
<config-property name="ConnectionURL" type="java.lang.String">jdbc:oracle:thin@129.225.88.88:1521:MySid</configure-property>
<blabla...UserName"...>yourOracleLogin</config-property>
<blabla...password"...>yourOraclePass</config-property>
6. Edit the the first lines in the file "jboss/server/default/conf/standardjaws.xml":
java:/OracleDS
<type-mapping>Oracle8</type-mapping>
false
.
.
. public CM3RM1 getCm()
{
Context jndiContext ;
DataSource datasource=null;
try{
Context ic = getInitialContext();
datasource = (DataSource) ic.lookup("java:/OracleDS");
} catch(NamingException name) { System.out.println(name.toString());}
try{
Connection conn = datasource.getConnection();
System.out.println("Got datasource "+conn.getCatalog());
cm.setNUMBERPRGN(1423);
cm.setConnection(conn);
cm.getRow();
System.out.print("Done.");
cm.setConnection(null);
}catch(SQLException sqlex){
sqlex.printStackTrace();
cm.setCATEGORY(sqlex.toString());
}
return cm;
}
private static Context getInitialContext() throws NamingException
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
env.put(Context.PROVIDER_URL, "jnp://localhost:1099");
return new InitialContext(env);
}
Now when I execute getCm from my client app I go not get any error but I get NO connection either!
I do not get any errors in the server logs when app server starts and it looks like it inits the pool ( I may be wrong )
What possibly may be wrong? I should get some kind of an error but I do not! I have no problem accessing a bean from the remote client.
Thanks in advance for your help.