Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

executing PL/SQL through JDBC

 
Grigory Ptashko
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
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
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 (8.1.7.4) 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,
Avi.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic