• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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);

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!