Technical Articles relating to Oracle Development Tools and Frameworks

Setting Up Embedded WLS for MySQL

Duncan Mills

For a while, on and off,  I've been playing with MySQL in various applications, to the extent that it made sense to work out how to specifically configure the domain so that the MySQL driver would always be available. The advice in the great googleblogosphere seems to be to drop the jar file in the DefaultDomain/lib directory and all will be well. But although you can then see the jar being loaded as WLS starts up, it certainly wasn't working for some of my pre-loading services within the container which could still not find the driver. (Although I'm not saying that this technique would not be OK for an ADF application that you deploy that uses MySQL)  

In the end I thought that the simplest thing was to work out what we do with the Oracle driver and emulate that. Sure enough it's there in the /DefaultDomain/bin/setDomainEnv script (.cmd or .sh).  You'll find it in there in the PRE_CLASSPATH section. So my solution was to simply add the driver reference there (code below reformatted for clarity):

if NOT "%PRE_CLASSPATH%"=="" (
set PRE_CLASSPATH=%COMMON_COMPONENTS_HOME%\modules\oracle.jdbc_11.1.1\ojdbc6dms.jar;
) else (
set PRE_CLASSPATH=%COMMON_COMPONENTS_HOME%\modules\oracle.jdbc_11.1.1\ojdbc6dms.jar;

And that's certainly done the trick for me.  So I think I can guarantee that at least one of the two methods here will work for you... At some point I'll put together a proper MySQL Extension for JDev that creates a library, sets this up, and registers a custom type-map for ADFBC, but alas time is always at a premium... 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.