Re: Serializing PreparedStatement, or: how do create a database history?



Chris wrote:
Hi,
I want to do the following and I hope you can give me hints on how to do this:


We have a Database (MS SQL over JDBC) which is not always necessary accessible. But this fact has to be transparent for the application which uses the db. If the db is not available, all updates/inserts and deletes must be saved (persistent on the harddisk!) and later be executed on the database (SQL select is not needed).
I first thought about serializing the PreparedStatement, but first of
If you don't have Connection - how can you get PreparedStatement?
all it is not serializable, second, all status about the database is lost.
Simply saving the SQL string does not help, as there can be binary objects in the query which are set using the PerparedStatement.
What objects - just parameters?
Serialize parameters and SQL string and reuse it later.
Kind of:
class SavedStatement{
  private String sql;
  private Object[]params;
  ....
}
As this is an extension to an existing program, and PreparedStatement is used there all over, building something around the PreparedStatement seems like the only solution.

If you have only the slightest suggestion on how this can be done, thanks a lot!

Regards,
Chris
.



Relevant Pages

  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... But SQL does not have a pointer data type or the ... > being told to design a database. ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: DBMS and lisp, etc.
    ... Naively implemented with SQL, again for 10 ... (1 query for the initial orders, 1 query for each order for its ... soon as you upgrade to the SQL database. ... (eq (order-customer orderA) ...
    (comp.lang.lisp)
  • Re: dbdebunk Quote of Week comment
    ... > a lot of really bad SQL programmers. ... a surrogate key should support the primary key. ... But SQL does not have a pointer data type or the ... > being told to design a database. ...
    (comp.databases.theory)
  • Re: dbdebunk Quote of Week comment
    ... But SQL does not have a pointer data type or the ... More and more programmers who have absolutely no database training are ... But why is little Cindy Lou Who employee ...
    (comp.databases.theory)
  • Re: Just say no to threads [Was: Software architecture]
    ... they knew there was going to be a database in the app. ... Now my colleague just spent a couple/three weeks designing an SQL ... Turns out they have a flat file of sample information, ...
    (comp.object)