• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 41860
908
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.
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic