File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Oracle Transaction and Stored Procs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Oracle Transaction and Stored Procs" Watch "Oracle Transaction and Stored Procs" New topic
Author

Oracle Transaction and Stored Procs

Chinmay Bajikar
Ranch Hand

Joined: Dec 08, 2001
Posts: 159
Hi,
I am creating a db connection using the URL,UserId,Password.

java.util.Properties prop = new java.util.Properties();
prop.put("user", UserID);
prop.put("password", Password);
Connection connection = DriverManager.getConnection(conn_url, prop);
connection.setAutoCommit(false);

The problem that I am facing is that,
My connection has autoCommit set to false.
I execute a Stored proc which inserts a row in the table.
Furthur down I fire a select query which tries to read the row which has just been inserted.
But the select query returns me zero rows.

But if I give the database name similar to the user id and then add it inside my properties file then this select query fires and returns me a row which was inserted by the stored proc.

java.util.Properties prop = new java.util.Properties();
prop.put("user", UserID);
prop.put("DBName", DBName);
prop.put("password", Password);
Connection connection = DriverManager.getConnection(conn_url, prop);
connection.setAutoCommit(false);

Fail to understand why such a thing happens.

Is there any Oracle server setting that I need to look into?

Thanks,
Chinmay


The strength of the Wolf is the pack & the strength of the pack is the wolf....Rudyard Kipling
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

Chinmay,
On the first try when you get zero rows, is there an exception thrown? I suspect that the user doesn't have permission to execute the stored proc.


[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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Oracle Transaction and Stored Procs