jQuery in Action, 3rd edition
The moose likes JDBC and Relational Databases 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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 32508
    
214

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.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, 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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Using Oracle package variables in JDBC.
 
It's not a secret anymore!