An Oracle JDeveloper How To Document
Written by Steve Anderson, Oracle Corporation
Last Updated: July 2005
ADF Business Components (ADF BC) can help you rapidly create a robust data-driven application. MySQL is a popular and easy to use database. Although ADF BC does take advantage of many of the extended features of the Oracle database, it can work with other databases, including MySQL.
The first step to working with any database in JDeveloper is to create a connection to the database. JDeveloper uses JDBC to connect to databases, so to connect JDeveloper to your MySQL database, you'll need to configure JDeveloper to use MySQL's JDBC library. First you'll have to configure JDeveloper to work with the MySQL Connector/J JDBC driver, then you'll need to create a connection.
Now you can use that library in any of your projects.
&ultraDevHack=true&capitalizeTypeNames=true&pedantic=trueYou may also need to add the parameter
&sqlmode=oracle. This parameter forces the JDBC driver to mimic the SQL features in the Oracle 7.x database.
In the Connections Navigator, you can click on your connection to see the defined tables, views, etc, in the database browser. For more information on the database browser, or database connections, see JDeveloper's online help.
Now that you have a connection defined, it's time to work with ADF BC.
Before running you through the steps, there are three issues you need to be aware of
Two new projects (Model and ViewController) will be displayed in the Application Navigator. The Model project is the one that we will have our ADF BC objects.
Normally what I'd tell people to do at this point is to run the Business Components from Tables wizard. Due to the fact that ADF BC doesn't understand the way MySQL defines primary keys in tables, though, we're going to define each ADF BC object manually. This isn't hard, but if you want to create a lot of objects, it can take a bit of time. Minimally, a ADF BC project is composed of one or more VOs and an AM. Often you'll also want one or more EOs, Associations, and View Links.
There is one other issue related to View Objects. When you are in the VO Editor, clicking on Attributes Mapping page throws an error. This is related to the problem with Expert Mode queries. If you need to modify these queries, do it by modifying the query rather than modifying the attribute mapping.
There are no special instructions for creating an Association, View Link or an Application Module when working with MySQL. Please see the JDeveloper online documentation for information on creating these types of objects. Remember, every ADF BC application needs an AM, so make sure you create one before you test your application.
You'll want to make sure everything worked, so right-click on the AM, and select Test. When the Browser Connect dialog is displayed, click Connect.
You can use the Business Components modeler with MySQL just like you can with any other database. If you are creating new EOs in the modeler, you will need to set the primary key on the attribute. Also, it will not automatically create associations or view links.
If you want access to the Javadoc for MySQL Connector/J,
mywork. The files will them end up in
mywork/mysql-connector-java<version>), and select
organd click open.
The best way to use the Javadoc is to create a jar file for it. You can do so from the command line by using the jar utility, or you can use JDeveloper's deployment tools.
mysql-connector-java--javadocand click OK. The JAR Deployment Profile dialog will be displayed.
In the Application Navigator, you should now see this deployment profile. Now we do the actual deployment.
The deployment log will list where the JAR file was created. It should be something like
mywork/MySQL Connector/Connector/deploy/mysql-connector-java-<version>-javadoc.jar. That file will contain all the Javadoc for the MySQL Connector/J library you have. Copy that file somewhere (such as into
mywork/lib). Now you can use the Javadoc for the JDBC driver.
It's very easy to do the same thing for the source. Create a deployment profile just like you did for the Javadoc. In the Contributors pane, select Project Source Path, and deploy that as a JAR file. You will then be able to debug into the JDBC driver if you need, or want, to do so.