EAR Files: with or without Data Sources?
By Sandra Muller on Nov 29, 2006
OC4J 10.1.3 allows you to include Data Source definitions with your EAR file. JDeveloper 10.1.3 automatically creates such EAR Files if you deploy to Oracle Application Server 10.1.3. But what if you don't want to include the database connect information in your EAR file?
In my opinion, data sources are useful for externalizing the database connections (development, test, production, ...) from the web application. I think it's best to use the same EAR file for all environments, and have different data source definitions in each environment. The data sources should have the same name of course, but connect to different databases.
In JDeveloper 10.1.3 I had defined an Application Server connection to our Development OC4J 10.1.3 instance, and discovered that the EAR files I created with JDeveloper deployment profiles always included data source definitions. That meant that I had to change the data sources in the Test and Production application servers after deploying this EAR file.
Fortunately, I also found a way to omit the data sources from the EAR file: remove all Application Server Connections from your JDeveloper 10.1.3 installation before creating the EAR file using a deployment profile. JDeveloper then cannot determine the type of application server you deploy to, and will not include the data source definitions.
Then it became much easier to use the same EAR file for all environments!