Saturday, April 24, 2010

Connecting MySQL Database with Jdeveloper 11g

Hi all,

In order to create ADF application on based on MySQL database you need some little different steps to work with it. Possibly you will hit by some bugs and for example you cannot create EOs and VOs by using normal Business Component Wizard you have to create Entity object, View Objects, Application Module manually (as i experienced). To connect mysql from any J2EE application you need to work with special driver called Connect/J.

Enough talking lets get into the steps

- Download MySQL from mysql website
- Install MySQL (as simple any blind man can do the installation)
- Make sure MySQL database is up and running (Windows services MySQL 5.1)
 Note: I have one table called Mytable in mysql database named "mysql"

- Download Connect/J and extract it on your computer
- Copy the mysql-connector-java-5.1.12-bin.jar file and paste into
(it is required you to create a custom domain in weblogic server to deploy your applications) 
- Rename the Jar file to mysqljdbc.jar for ease of administration.

Creating connection in Application:

- Create New ADF fusion based on Fusion application template.
- Create connection named mysqlconn
- Enter settings as shown in the slide (its the defaults of mysql)
- Click the Browse button with the Library
- Create New on the Left side Add an Entry called MYSQL in User Section
- Select Classpath and Choose Add Entry and select the path where you have putted the mysqljdbc.jar file
- Click OK

- Test the Connection

Creating EOs, VOs and AM:
- I am not going into detail (if you are regular blog visitor you know the rest) of these steps just for help you can follow the important slides.
- Right click on Model Page and Choose New Entity Object

 - Right click MyTableEO and choose New Default View Object.

 - Create Application Module

- Add an Instance of MyTableVO

- Right Click Application Module Choose Run
- Business Component Browser will open which means our Model project is Working OK

-Create a Basic JSF page and Drag and Drop ADF Read-only Table on the page

Note: You might not able to run it from integrated weblogic server because of our mysqljdbc.jar is not in classpath of the integrated weblogic server 

Next Step: Deploying MySQL based ADF application to Weblogic Server



  1. Hi,

    Two points be carefull with mysql and adf bc, you can't passivate or activate am sessions because mysql cant work with the ps_txn table

    and when you deploy to a wls then you better replace the internal connector/j library , Oracle deliver wls with a old version 5.0.5


  2. Thanks edwin for your comments

  3. Thank you for your blog.

    But have you ever faced the issue described in ?

    Please reply in forum.

  4. Nice one yaar.. Tanx a lot.. i could'nt find better than this..

    Keep blogging.. i am very new to ADF ( just 3 days)

  5. Very Lovely article.

    I am however having issues.

    I am using JDeveloper 11g R2 and MySQL running on MAC OSX 10.8.1.

    I can connect to the database from JDeveloper and i can create EOs and Associations but when i bind an OutputTextFormatted to one of the Data controls and run the application, I get the following error

    Messages for this page are listed below.



    with the below stack trace (truncated)

    <_checkTimestamp> Apache Trinidad is running with time-stamp checking enabled. This should not be used in a production environment. See the org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION property in WEB-INF/web.xml
    ADF: Adding the following JSF error message: com/mysql/jdbc/MySQLConnection
    java.lang.NoClassDefFoundError: com/mysql/jdbc/MySQLConnection
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(

    I changed the Connection type for the AppModule from JDBC DataSource to JDBC URL and then i get the following error

    Application module is not connected to a database.

    with the below stack trace (Truncated)

    ADF: Adding the following JSF error message: Application module is not connected to a database.
    oracle.jbo.NotConnectedException: JBO-25200: Application module is not connected to a database.
    at oracle.jbo.server.DBTransactionImpl.checkConnected(
    at oracle.jbo.server.DBTransactionImpl2.createPreparedStatement(
    at oracle.jbo.server.DBTransactionImpl.createReUsePreparedStatement(
    at oracle.jbo.server.ViewObjectImpl.getPreparedStatement(
    at oracle.jbo.server.ViewObjectImpl.getPreparedStatement(
    at oracle.jbo.server.QueryCollection.buildResultSet(
    at oracle.jbo.server.QueryCollection.executeQuery(
    at oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(
    at oracle.jbo.server.ViewRowSetImpl.execute(

    Any Help will be greatly appreciated.

    Best Regards


    1. Hi,

      Looks like there are some issues with configuration. Please double check the steps above. Use JDBC datasource and make sure you have created the datasource in weblogic server and your jdbc driver path exists in CLASSPATH

      the error CHECK_FILE_MODIFICATION is not related you can turn off this by modifying web.xml in the application.


  6. Not working on linux

    1. Make sure your CLASSPATH is set to drivers location.


  7. Hello Zeeshan,
    I've done what is said in this post but when I run the application on glassfish or in model tester - just querying one table - I get the following exception:

    (oracle.jbo.jbotester.ErrorHandler$ExceptionWrapper) JBO-29000: Unexpected exception caught: java.lang.AbstractMethodError, msg=com.mysql.jdbc.ResultSet.isClosed()Z
    ----- Level 1: Detail 0 -----
    (java.lang.AbstractMethodError) com.mysql.jdbc.ResultSet.isClosed()Z

    Could you suggest a solution?