Wednesday, February 14, 2007

Using MySQL with OC4J 10.1.3.x

When you have OracleXE available for free you would probably not use MySQL, but you may have a valid requirement to use MySQL with OC4J 10.1.3.

1. Upload JDBC Driver You have to make JDBC drivers (e.g. mysql-connector-java-3.0.11-stable-bin.jar) for your database available to Oracle Application Server. You have to copy those to %ORACLE_HOME%/j2ee/home/applib directory.

2. Create a Native DataSource

You can use the ASC to create a native data source as follows:

description="Native DataSource" data-source-class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"

Now you should be able to access the DataSource connecting to MySQL database with a JNDI location "jdbc/MyDS".

1 comment:

Anonymous said...


In the latest build of OC4J and Oracle AS (, July 2008) the contents of j2ee/home/applib directory is disabled, so it's not enough to put the mysql driver jar in that directory, you also have to edit the j2ee/home/application-deployments/ascontrol/orion-application.xml file and comment out the line with following tag:

remove-inherited name="global.libraries"

For more info, check this post on the Oracle OC4J forum:

Hope this will help other people,