Hi,
I have written a simple Java Client to connect to an Application Server 10.1.3.1 & lookup a DataSource. I have downloaded the OC4J_Client.jar file from the the OTN Page & included a couple of the JAR Files. This is the JDeveloper ClassPath :-
D:\Jdeveloper\jdk\bin\javaw.exe -ojvm -classpath D:\Jdeveloper\jdev\mywork\Oracle_Test\Oracle_DataSource_Project\classes;
D:\Jdeveloper\jdbc\lib\ojdbc14.jar;
C:\JARFiles\j2ee\home\oc4jclient.jar;
D:\Jdeveloper\j2ee\home\lib\activation.jar;
D:\Jdeveloper\j2ee\home\lib\ejb.jar;
D:\Jdeveloper\j2ee\home\lib\jms.jar;
D:\Jdeveloper\j2ee\home\lib\jta.jar;
D:\Jdeveloper\j2ee\home\lib\mail.jar;
D:\Jdeveloper\j2ee\home\lib\servlet.jar
The code I have written is quite simple :-
private static void getConnection() throws Exception
{
Hashtable objEnvironment = null;
InitialContext objInitialContext = null;
Connection objConnection = null;
objEnvironment = new Hashtable();
objEnvironment.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
objEnvironment.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
objEnvironment.put(Context.SECURITY_CREDENTIALS, "xxxxxx");
objEnvironment.put(Context.PROVIDER_URL, "opmn:ormi://152.69.188.80:6003:OC4J_SS2/");
InitialContext context = new InitialContext(objEnvironment);
Object objDataSourceObject = context.lookup("jdbc/testDataSource");
System.out.println(objDataSourceObject.getClass());
DataSource objDataSource = (DataSource)objDataSourceObject;
System.out.println(objDataSource.getClass());
System.out.println("Before the Connection");
objConnection = objDataSource.getConnection();
I know I am missing some vital JAR File, but I can't figure out which one. Can you guys tell me a list of the JAR files that re necessary to do a simple DataSource Lookup ? I sthe list available in any Online Document ?
I am using JDeveloper 10.1.3.
Thanks,
Sandeep