File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes ResultSet.updateInt(...) generated sql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "ResultSet.updateInt(...) generated sql" Watch "ResultSet.updateInt(...) generated sql" New topic

ResultSet.updateInt(...) generated sql

Thomas Mcfarrow
Ranch Hand

Joined: Jul 09, 2001
Posts: 137

Currently we are using MySQL and the JDBC connector for our application. In some cases we are doing :

ResultSet rset ....


I have a simple question, is there a easy way to get the SQL generated by this statement programatically? We are looking at implementing MySQL bin-log alternatives for the app.
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Not too likely. The SQL would look something like this:

UPDATE table SET field = value WHERE primarykey = value

Most of that could be done, but your code doesn't know which column is the primary key. MySQL does (if there isn't one, it will complain) but your code doesn't. Unless perhaps you had a convention where the primary key is the first column, or something like that.
Thomas Mcfarrow
Ranch Hand

Joined: Jul 09, 2001
Posts: 137
Basically I am trying to implement a MySQL bin-log that saved in the database. The alternative is to write bridge code that will move the log to a table.

Or remove the updatable resultsets. IMHO, updatable resultsets are slower than a straight insert or update.

The whole idea was not exposing db architecture to the client.
I agree. Here's the link:
subject: ResultSet.updateInt(...) generated sql
It's not a secret anymore!