Re: Database programming standards

  • From: Fernando <fernandoluis@xxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Thu, 3 Jun 2004 08:54:00 -0700

It's trivial:

PreparedStatement pstmt = conn.prepareStatement ("update EMP set ENAME = ? where ROWID = ?");

pstmt.setString (1, ename.toLowerCase ());

pstmt.setString (2, rowid); // Pass ROWID to the update statement

pstmt.executeUpdate (); // Do the update

and you can also use this for output from stored procedures:

String str = new String("{call begin ? := function_name_here('something here');end}");

CallableStatement cs = db.prepareCall(str);

cs.registerOutParameter(1, Types.INTEGER);

and then you can do a


int value = cs.getInt(1);

It's really very, very easy to use. Of course, it helps if people read the manuals.

On Jun 3, 2004, at 8:37 AM, Duret, Kathy wrote:

We have the same problem here, they don't want to write sql. They claim
there is no way to use bind variables in Java (we are using Jbosse). I
haven't had time to look into it. I would assume there is. Can someone
point me to a link or forum?



Other related posts: