This is how to do it using SJSAS, I'm confident it will work with any server by supplying the correct URI and port numbers (and of course including the correct jars in your classpath):
Quote:
1. Add three Java archives (JARs) to your class path in the lib directory of Application Server's root installation directory: j2ee.jar, appserv-rt.jar, and appserv-admin.jar.
2. Set the values for the Java virtual machine startup options, as follows:
jvmarg value = "-Dorg.omg.CORBA.ORBInitialHost=${ORBhost}"
jvmarg value = "-Dorg.omg.CORBA.ORBInitialPort=${ORBport}"
where ORBhost is Application Server's host name and ORBport is the ORB port number, whose default is 3700 for the default instance. You can obtain that information from the domain.xml file on the remote system. For details on that file, see Chapter 1 in Sun Java System Application Server Enterprise Edition 8.1 Administration Reference.
Here is an example of the compilation command line (all on one line):
java -classpath.;c:\Sun\AppServer.ib\j2ee.jar;c:\Sun\App Server.ib\appservrt.jar;c:\Sun\AppServer.ib\appser v-admin.jar-Dorg.omg.CORBA.ORBInitialHost=localhost-Dorg.omg.CORBA.ORBInitialPort=3700 MEJBStandaloneClient ejb/mgmt/MEJB
|
This looks up EJB resources, but JDBC resources should be no different.
I've seen a lot of people trying what you did (and tried it myself just on the off chance it might work and to see why it didn't).
It's not only something that (generally) won't work (might work inside the container but don't count on it) but it's bad programming practice as it introduces a hard dependency on a specific appserver.