File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Computer name through JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Computer name through JDBC" Watch "Computer name through JDBC" New topic

Computer name through JDBC

Danish Araquei

Joined: Jul 05, 2006
Posts: 19
Hi All,

In our application i want computer name.

We are using the following step

1) Login to Our System(Browser).
2) From session bean we update one table,while updating that table one trigger is fired.
3)In trigger we update another table along with User-Name(Client name/Browser).In trigger we write following syntax to getting User Name

select sys_context('USERENV','TERMINAL') from dual;

but we are getting User name as null .

While debugging through pl/sql dev or executing that query we are getting USERNAME from which we logged to oracle.

Tim LeMaster
Ranch Hand

Joined: Aug 31, 2006
Posts: 226
That is because the JDBC connection is not setting up this when it is connecting. Besides the client machine/browser is not connecting to the database - the app server is (where SessionBean is running) more over it is probably using a Connection Pool so all users are running under the same username/password to the database.

Most likely you need to capture the username they logged into the application with and send that along with the insert to capture the user actually making the change.
I agree. Here's the link:
subject: Computer name through JDBC
It's not a secret anymore!