• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Oracle Transaction and Stored Procs

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 40747
827
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic