Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / September 2004

Tip: Looking for answers? Try searching our database.

Problem in executing pl/sql block through jdbc

Thread view: 
Anand - 20 Sep 2004 17:37 GMT
Hi All,

I am trying to execute contents of a sql file on an oracle 8i database
using java.The requirement is such that I can't run the file directly
on the DB server.
Further, since I could not find any method to run the sql file
directly through jdbc, I decided to parse the scripts from the file,
and execute them using executebatch.
The file contains some sql commands as well as pl/sql blocks (these
blocks create some triggers).
The program works fine and terminates without any exception; but when
I try to invoke any of the triggers, I receieve ORA-04098 error saying
that the trigger REGISTRY_INSERT is invalid and failed re-validation.

If I try to execute those pl/sql blocks directly on sql prompt or
through TOAD, the triggers get created succesfully and they can be
invoked without any problem.

Just to ensure that there is no problem in reading the contents of the
file, I redirected the output of the java class to a text file, copied
all commands and executed them on sql plus. This gave me succesfull
results.

I don't get any exception/errors while running the sql commands
through jdbc.

Could anybody help me on this.

Thanks in advance,
Anand
Galen Boyer - 20 Sep 2004 18:01 GMT
> Hi All,
>
[quoted text clipped - 5 lines]
> using executebatch.  The file contains some sql commands as
> well as pl/sql blocks (these blocks create some triggers).  

You shouldn't create triggers on the fly.  This should be a DBA
operation, not application operation.

> The program works fine and terminates without any exception;
> but when I try to invoke any of the triggers, I receieve
[quoted text clipped - 14 lines]
>
> Could anybody help me on this.

Don't know.  Post the code and error messages.
Signature

Galen Boyer

Anand - 21 Sep 2004 07:42 GMT
Thanks for your reply; there was problem with file parsing. Used
bufferedReader's readLine() instead of read() alongwith little bit of
tweaking with code and everything got sorted out.

Anand
Galen Boyer - 21 Sep 2004 15:32 GMT
> Thanks for your reply; there was problem with file
> parsing. Used bufferedReader's readLine() instead of read()
> alongwith little bit of tweaking with code and everything got
> sorted out.

Well, I hope you also removed the creation of triggers within
your java code.

Signature

Galen Boyer



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.