Monday Feb 18, 2013
Thursday May 17, 2012
By Duncan Mills on May 17, 2012
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...
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
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!
- Customizing the Axis Labels in ADF Graphs
- Stretching an inputText inside of a Table Column
- Programmatic UI Scrolling in ADF Faces
- JAX-RS 2.0 MessageBodyReader not found error
- Current Date / Time on your JSF pages
- Click History Part 2 - Access from Java
- Click History in ADF 12c
- Quick Reference for Popup Alignment
- Basic WebLogic Deployment Plans for your ADF Application
- Using Teams with Hudson 3.1