Wednesday, November 24, 2010

Calling an Oracle database procedure from Java with only ONE line of code

About a year ago I was working on an ADF application for one of our clients. One of the problems they faced was that they needed to call a lot of database procedures. It is not very hard to call a database procedure if you are familiar with the JDBC API, but somehow they were able to mess it up. And even if you do it right, you have to write quite a few lines of Java code for one database procedure call. How can we simplify this?

Wouldn't it be nice if you could copy the specification of a PL/SQL procedure or function and then... just call it? That is exactly how my DatabaseProcedure class works.