Most of us working in corporates, use Oracle mostly. It probably has a uptime of 99%. But sometimes, it does go down and when it does, it’s frustrating for the developer, especially when you’re in the middle of something.
We can’t have a local database instance running and having a hsqldb or mysql database would not really give us the confidence of working in the “actual world.” So, How can you have a local Oracle database without all that fuss?
Here is an alternative that I tried and it worked like a charm for me.
1) Install Oracle 10G XE . Its a light-weight version of 10G and its *free*. There is no configuration whatsoever, just the password for admin username, “system”
2) After installation you’re basically done. I use Open Oracle SQLDeveloper for the client. I think its simple and does everything you need. And its *free*. Make a new connection with
host – localhost, port – 1521, SID – xe
Surprisingly, all the above are provided by default! Now, setup a new user for your application. Grant “all” rights.
3) In my web application, I use a top-down approach with a rich domain model with JBoss Seam Framework where the schema is 100% generated by hbm2ddl. For static data, I have an import.sql in the web-inf. All I need to do is, change the hibernate.hbm2ddl.auto value back to “create” (it was “validate” before)
And change the datasource connection to jdbc:oracle:thin:@localhost:1521/xe in the jndi datasource in jboss server.
4) Change the jboss http port from 8080 to 8081 from here
jboss-4.2.2\server\default\deploy\jboss-web.deployer\server.xml
(as oracle server uses the same)
5) Start JBoss server
That’s it. All in all, it took around 20-25 minutes. (including the installation)
I now have a new oracle database installed, new tables created, new static data setup and most importantly — I did not add any configuration file(s) whatsoever and nothing in my app was changed except the ds file (which again is outside the ear file). I did not run any ruby scripts, nor groovy scripts and No — I didn’t call my DBA to setup the database or run some data scripts for me.
And the application deployed SUCCESSFULLY.
All this in less than 25 minutes.
This,, I think is agile Domain Driven Development using Seam framework.
I’m wondering if I could’ve done this 5 years ago. Not without hiring a consultant for a project named “database migration.” and not without changing so many files.
Post a Comment