Working with WebLogic connection pool...

Hello all,

I have been programming in Java for a couple of years, however, I am fairly new to WebLogic server. I was able to install it and to create a connection pool to my database, using oracle.jdbc.driver.OracleDriver as a driver and jdbc:oracle:thin:@hostname:port:dbserver for url. The pool was created with no problem. Next, however, I need my applet to access this connection pool to retrieve data from the database (I used ODBC before). Here's the piece of code that I used:

try {

Class.forName("oracle.jdbc.driver.OracleDriver");

Properties props = new Properties();

props.put("connectionPoolID","provPool");

System.out.println("Driver is loaded!");

Connection dbconn = driver.connect("jdbc:oracle:thin:@hostname:port:dbserver", props);

} catch (Exception x) {

x.printStackTrace();

}

I know it looks kinda crude, but, as I mentioned before, I have little familiarity with WebLogic. Anyway, what it gives me is this:

java.lang.ClassNotFoundException: java.io.FileNotFoundException: L:\...\...\oracle\jdbc\driver\OracleDriver.class (The system cannot find the path specified)

From what I see, it cannot load the driver I'm specifying. I have tried several things. I already have the necessary drivers available (classes12.zip and classes111.zip). I have included the paths to these driver in my CLASSPATH variable, I have added oracle.jdbc.driver.OracleDriver to the list of the drivers in Database Pilot (in JBuilder 5 Professional), I have created a new library with these drivers and attached to the project, and nothing seemed to work. I've been banging my head over this problem for quite a while, so I hope anyone here could help me to at least understand what am I doing wrong and where might the problem hide.

Thank you for your help, I'm looking forward to heard from any of you.

PS. I'm using WebLogic 5.1.1

[1934 byte] By [bgolman] at [2007-9-26 7:05:27]
# 1

Java uses a JDBC driver. (One can use more than one driver but that is irrelevant for this discussion.)

When you create a web logic connection pool weblogic is now managing the connections.

And that means that you will no longer use anything called 'Oracle' in your JDBC stuff. But you are doing that.

Instead you should be using the weblogic driver. Their site has at least one example of this. You will need to package (or somehow get) the weblogic driver classes to make them available to your applet. I believe the weblogic site also discusses this.

jschell at 2007-7-1 16:44:39 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Hello,

You are trying to get a connection from a Weblogic connection pool and from an applet. To do so, one can suggest to embed / implement a t3Client (BEA special feature) within your applet. I think it is the only way to retrieve the resources defined by your Weblogic server.

For more details:

http://www.weblogic.com/docs40/classdocs/API_jdbct3.html#connpoolget

Indeed, the piece of code does not work because the applet cannot load the Oracle driver.

To fix it, one can suggest to add the Oracle JDBC driver to the Weblogic classpath (the Weblogic classpath and not the Java classpath) and to register the ClasspathServlet servlet (Normally it is already done because the applet is up and running).

However, the implementation will not use the Weblogic connection pool: it creates its own socket to communicate with the database.

Hereafter a really helpful link if you want to assess the Weblogic server:

http://edocs.bea.com/

I hope it helps

giannydamour at 2007-7-1 16:44:39 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

Thanks for your replies. Apparently, you are right, it will be best for me to use weblogic driver, particularly, weblogic.jdbc.pool.Driver. However, I have my weblogic directory in drive E:\, while my applet is in the main "library" drive L:\. That's, pretty much, the reason, the applet can't find the driver in the run time, while reading this line:

Class.forName("weblogic.jdbc.pool.Driver")

It assumes, that weblogic/jdbc/pool/Driver.class supposed to be in the code base, specified in my applet tags, which is not where I want it to look for the driver. Is there a way I can direct my applet to the drive where weblogic is? I updated weblogic classpath, but that didn't solve the problem.

Thanks again, I'm getting closer. ;-)

bgolman at 2007-7-1 16:44:39 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...