Spring Roo, Maven and Oracle JDBC drivers

Oracle JDBC drivers are not freely available in any public Maven repos. Per the Spring Roo docs, if you have an Oracle product installed (presumably you do if you’re trying to connect to it), you can install the provided JDBC driver into your local Maven repo for your code to build successfully.

Using Roo 1.1.5, setting up my persistence with:

persistence setup --provider HIBERNATE --database ORACLE --databaseName XE

Resulted in this dependency added to my pom.xml:

	<dependency>
		<groupId>com.oracle</groupId>
		<artifactId>ojdbc14</artifactId>
		<version>10.2.0.2</version>
		<classifier />
	</dependency>

I’m using Oracle Express 11.2.2.0 on my machine, and my JDBC driver installed with the product is here:

C:oraclexeapporacleproduct11.2.0serverjdbclibojdbc6.jar

So using the Maven install command, I can copy this file into my local repo like this:

mvn install:install-file 
    -Dfile=ojdbc6.jar 
    -DgroupId=com.oracle 
    -DartifactId=ojdbc6 
    -Dversion=11.2.0.2.0 
    -Dpackaging=jar 
    -DgeneratePom=true

And then update my jar dependency in my pom.xml to match the version of the jar that I have:

	<dependency>
		<groupId>com.oracle</groupId>
		<artifactId>ojdbc14</artifactId>
		<version>11.2.0.2.0</version>
		<classifier />
	</dependency>

Configuring Oracle Express 11g on a development machine

If you install Oracle Express 11g on laptop running Windows that is normally part of a domain and then try and run that machine elsewhere connected to a different network than normal, you may need to tweak the hostname value in your tns confiig files.

For example, my work laptop has a domain name set which is specific to my work network. When running from home and connected to the internet I’m not part of this domain, and this seems to mess with your tns config.

Browse to this location (or similar):

C:oraclexeapporacleproduct11.2.0servernetworkADMIN

Edit each of the .ora files in this location and replace your fully qualified hostname  and domain name for the HOST property to be just 127.0.0.1. I’m not sure if this means your listener is no longer listening for connections outside of your machine, but if this is a development machine this doesn’t matter.

Stop and restart your database (XE is the default for Oracle Express), and you should be good to go.

tnsping XE should now respond with OK.

 

Configuring mysqld to listen for remote connections

I’m not sure if I originally configured this or if this is the default. My my.cnf file had this line in it which configures mysql to only listening for incoming connections from localhost and ignores all remote connections:

bind-address            = 127.0.0.1

Changing this to be the real ip of the server will allow it to listen for remote connections.