This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes Using Oracle package variables in JDBC. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using Oracle package variables in JDBC." Watch "Using Oracle package variables in JDBC." New topic
Author

Using Oracle package variables in JDBC.

Kumar Shanmugam
Greenhorn

Joined: May 14, 2004
Posts: 29
Can anybody know how we can use Oracle Package variable in Java/JDBC?

I am using a insert trigger on a table which will initialize the login user
from a package variable.In my log4j configuration file, while inserting data into this table, I am updating the user with my current user. But the insert statement is not identifying the user and it is inserting null.

PLease let me know.


Kumar Shanmugam,<br />Atlanta, USA.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Kumar,
A trigger is defined on the database, not through JDBC. So this gets the problem out of the Java sphere.

If you can post the trigger here, maybe someone will see a problem with it.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kumar Shanmugam
Greenhorn

Joined: May 14, 2004
Posts: 29
Here is the trigger.

----------------------
create or replace TRIGGER DWUSER.TDS_JAVA_LOG_TRIG
BEFORE INSERT
ON DWADMIN.TDS_JAVA_LOG
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
tmpVar NUMBER;
BEGIN
tmpVar := 0;

:NEW.login_date := systimestamp;
:NEW.user_id := log_user.v_log_user;

END tds_java_log_trig;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using Oracle package variables in JDBC.