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 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.
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

Use something that is always available, like Derby or MYSQL, then sync the two at your convenience.
.




Relevant Pages

  • Re: get SQL statement from PreparedStatement
    ... PreparedStatement to the database to execute? ... SQL into some driver or database specific format that allows for value ...
    (comp.lang.java.programmer)
  • Re: Serializing PreparedStatement, or: how do create a database history?
    ... If the db is not available, all updates/inserts and deletes must be saved and later be executed on the database (SQL select is not needed). ... 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. ...
    (comp.lang.java.databases)
  • Re: get SQL statement from PreparedStatement
    ... The idea behind the prepared statement is that the driver or database will precompile the SQL into some driver or database specific format that allows for value bindings. ... If what you really wanted to achieve was to known what parameters are being passed to the PreparedStatement there are JDBC spy tools that can help. ... you do not "execute the SQL in PreparedStatement." ...
    (comp.lang.java.programmer)
  • Re: Serializing PreparedStatement, or: how do create a database history?
    ... > I first thought about serializing the PreparedStatement, ... > all it is not serializable, second, all status about the database is lost. ... > As this is an extension to an existing program, and PreparedStatement is ... transparency layer". ...
    (comp.lang.java.databases)
  • Re: Serializing PreparedStatement, or: how do create a database history?
    ... If the db is not available, all updates/inserts and deletes must be saved and later be executed on the database (SQL select is not needed). ... I first thought about serializing the PreparedStatement, but first of all it is not serializable, second, all status about the database is lost. ... 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. ...
    (comp.lang.java.databases)