This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Table backup - programmatically using JDBC  RSS feed

 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
author & internet detective
Posts: 39054
714
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39054
714
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, you are going to have to write the code. You can use metadata to write in once for any table though.
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!