aspose file tools*
The moose likes JDBC and the fly likes Table backup - programmatically using JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Table backup - programmatically using JDBC" Watch "Table backup - programmatically using JDBC" New topic
Author

Table backup - programmatically using JDBC

Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
My application requires that I take a backup of a table onto a file on the hard disk programmatically before I actually delete all the rows in the table.
Currently we take the backup manually using Toad for Oracle before running the application, but I was wondering if there is any standard API that does it for me in JDBC? :roll:
I know I can write code to open a JDBC Connection, run an SQL stmt, "select * from mytable", iterate thru the ResultSet and write to a file.
But is there a better or a simpler approach?.....
Can I serialize a ResultSet?
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Vish,
You could run TOAD at the command line. A script could kick off TOAD and then your java program. Or your java program could call TOAD before deleting.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
Thanks Jeane,
But the idea is, not to use any tools like Toad or SQL export utility.
It would be easy for us, if we can call directly from our java aplication.
The production env support machine is likely to have only JDK and JDBC
driver installed on it.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

In that case, you are going to have to write the code. You can use metadata to write in once for any table though.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Table backup - programmatically using JDBC