Thread: execute sql script file with Oracle JDBC


Permlink Replies: 2 - Pages: 1 - Last Post: Nov 19, 2007 10:44 AM Last Post By: Steve Heidebrink
Jeroen Stiekema

Posts: 29
Registered: 03/15/05
execute sql script file with Oracle JDBC
Posted: Nov 19, 2007 4:25 AM
Click to report abuse...   Click to reply to this thread Reply
I have a couple of sql-scripts, such as creating new users, creating tables, etc., which I want to load automatically by the use of a Maven plugin. Therefore, I'm searching for a manner to pass an sql script file as a stream to the Oracle JDBC-driver. Unfortunately, I cannot find such a method in the documentation.

Is there someone who knows if there is a method to load sql scripts and execute it with the Oracle JDBC driver?

Regards,

Jeroen
dvohra16

Posts: 6,037
Registered: 07/02/01
Re: execute sql script file with Oracle JDBC
Posted: Nov 19, 2007 10:27 AM   in response to: Jeroen Stiekema in response to: Jeroen Stiekema
Click to report abuse...   Click to reply to this thread Reply
Steve Heidebrink

Posts: 473
Registered: 01/08/02
Re: execute sql script file with Oracle JDBC
Posted: Nov 19, 2007 10:44 AM   in response to: Jeroen Stiekema in response to: Jeroen Stiekema
Click to report abuse...   Click to reply to this thread Reply
Here is something that might be of interest to you:

http://forum.java.sun.com/thread.jspa?threadID=636980

Other options include:

1) Maven SQL Plugin http://mojo.codehaus.org/sql-maven-plugin/

2) Writing your scripts wrapped in begin...end statements and then using Java IO to open the file and send in the string (similar to the post above)

Does any of that help?
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums