This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes Java API for executing sql scripts (mysql / oracle) ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java API for executing sql scripts (mysql / oracle) ?" Watch "Java API for executing sql scripts (mysql / oracle) ?" New topic
Author

Java API for executing sql scripts (mysql / oracle) ?

Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
Hi,

Would anyone happen to know if there's a java API for executing entire ".sql" files (containing several different SQL commands), on a remote database server ?

It's enough if the API works with MySQL and/or Oracle.


Just to demonstrate what i'm looking for:
Suppose you've created sql file "c:/test.sql" with several script lines:
-- test.sql:
insert into TABLE1 values(3,3);
insert into TABLE1 values(5,5);
create table TABLE2 (name VARCHER) ENGINE innoDB; -- MYSQL specific

Then the java API should look something like:
// Dummy java code:
String driver="com.mysql.jdbc.Driver";
String url= "jdbc:mysql://localhost:3306/myDb";
SomeAPI.executeScriptFile( "c:/test.sql", driver, url);

Thanks.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Java API for executing sql scripts (mysql / oracle) ?