Forums Register Login
Read and Write .sql files using java
I want to know if there are any freeware's available to read and write .sql files. I hava a .sql file with set of insert statements and I need to identify the values that are pushed into table, the table name, the inner query clauses etc., from the sql statement.

After identifying, need to translate and push those changes back to the .sql file. Is there any way to do this with help of parsers rather reading the whole of file line by line.

I did come across few parsers like ZQL, sqljep etc., but could not really solve the issue. Please help..
Thanks in advance.

Is this a one-time use for yourself or part of an application you need to build? Stuff like this is often easier to write yourself in Java assuming the kinds of changes you need to be make can be made with regular expressions and the files you are reading are highly structured. The issue with 'generic' read/write tools is that every database has its own unique flavor of SQL and not all of them exactly match each other even on some basic commands.
Say I have a line like below,

These statements gets repeated in the file consecutively. I need to get the insert column values (like user_id, module_id etc.,) and values that are inserted into the table (like 'LANGUAGE', 'L','system_preferences' etc., ) into any data structure. And also replace the values with translated values in same positions in writing back the values.
Switching from electric heat to a rocket mass heater reduces your carbon footprint as much as parking 7 cars. Tiny ad:
ScroogeXHTML 7.1 - RTF to HTML5 / XHTML converter

This thread has been viewed 2243 times.

All times above are in ranch (not your local) time.
The current ranch time is
Feb 18, 2018 19:08:18.