After I finished the first deployment to Oracles Application Server a coworker asked me about how to configure Data Sources in that setup. So finally yesterday evening I booted my second laptop up into SuSE Linux Enterprise Server 9 SP3 to start looking at that.
The first problems I encountered were “How did you start up this thing again?” & “What’s the administrator user name and password for this server?”. It was only three weeks since I played with that server but in the meantime I played with other application servers. It took me a while but finally I got everything under control.
The next question was to find a database to run alongside on the laptop. Since I ride the train and work in different places, I prefer complete self-hosted environments. So I took the sample PointBase database from Creator for my tests.
- I quickly created a simple application with a drop down list bound to the DB, a button and a static text.
- I exported it as a *.war file for J2EE 1.3 and deployed it to OC4J.
- I did the jsp-cache-tlds=”off” change as described in my earlier posts.
So far so good. That worked before without data sources. Now what to do for JDBC connections?
- I found on the web that I should stick the JDBC driver *.jar file into $ORACLE_HOME/j2ee/home/applib. So I copied the pbclient.jar there.
- Restart the server. That might not be needed because I believe the following changes require another restart before everything is done.
- The next steps are done in the Oracle Enterprise Manager, if somebody wants to edit *.xml files, it would be $ORACLE_HOME/j2ee/home/application-deployments/<YouApp>/data-sources.xml.
- Go back to the >OC4J:home>Application: <YourApp> page.
- At the bottom of that page, you see a Data Sources link. This brings up the list of configured Data Sources for the application. None so far.
- Hit Create here which will bring up a page where you can fill in all the details about the Data Source. The screen shot below shows that page:
The interesting fields are the Location (should match the resource-ref name in the web.xml of your application), the Data Source Class (probably always com.evermind.sql.DriverManagerDataSource for everything except Oracle DB’s) and the JDBC Driver (is com.pointbase.jdbc.jdbcUniversalDriver for my test setup).
JDBC Url, Username and Password are needed as well;-)
A couple of other fields need values but they are not interesting for web applications.
- Apply the changes and restart the server if needed.
- Now you should be able to browse to http://localhost:7777/<YourApp> and be happy;-)
Have fun with your data bases;-)