Setting Up Embedded WLS for MySQL

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;
                    d:\shared\mysql\mysql-connector-java-5.1.18-bin.jar;%PRE_CLASSPATH%
) else (
  set PRE_CLASSPATH=%COMMON_COMPONENTS_HOME%\modules\oracle.jdbc_11.1.1\ojdbc6dms.jar;
                    d:\shared\mysql\mysql-connector-java-5.1.18-bin.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... 

Comments:

Post a Comment:
Comments are closed for this entry.
About

Hawaii, Yes! Duncan has been around Oracle technology way too long but occasionally has interesting things to say. He works in the Development Tools Division at Oracle, but you guessed that right? In his spare time he contributes to the Hudson CI Server Project at Eclipse
Follow DuncanMills on Twitter

Note that comments on this blog are moderated so (1) There may be a delay before it gets published (2) I reserve the right to ignore silly questions and comment spam is not tolerated - it gets deleted so don't even bother, we all have better things to do with our lives.
However, don't be put off, I want to hear what you have to say!

Search

Archives
« April 2014
MonTueWedThuFriSatSun
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today