Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JDBC and Relational Databases and the fly likes executing PL/SQL through JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "executing PL/SQL through JDBC" Watch "executing PL/SQL through JDBC" New topic

executing PL/SQL through JDBC

Grigory Ptashko

Joined: Feb 21, 2003
Posts: 9
I have a question regarding PL/SQL and JDBC.
I have a file which is about 500 kb in its size with PL/SQL procedures, declarations, etc.
How can I execute it through JDBC?
The problem is that I have to write an installer for an app which uses db Oracle, and while installing I have to create a scheme in Oracle.
First I thought about executing SQLPlus on that file from the Java VM, but I was told to do this through JDBC.
Is there any way ?
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1135

Hi Grigory,
I executed the below java code on a Windows XP computer using J2SE SDK 1.4.1_02 and Oracle (thin) JDBC driver (file: ojdbc14.jar) against an Oracle 8i ( database running on SUN [sparc] Solaris 7

Note that file "plsql000.txt" is a plain text file that I put in the same directory as my compiled java code -- the "JdbcTest.class" file. This is the contents of file "plsql000.txt"

Note that the "plsql000.txt" file has a trailing blank line (but I don't know if that's important or not).
Hopefully this will help you.
Good Luck,
Have you tried LearnNowOnline?
subject: executing PL/SQL through JDBC