• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Oracle Transaction and Stored Procs

 
Chinmay Bajikar
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34863
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic