Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Pro*C Database connection - How do I identify a connection
I have written a class which encapsulates my Pro C code. This class
has a member function that connects to the database.
The problem:
If I have 2 instances of the class instatiated each instance should
be required to connect. This does not seem to work correctly. If I
declare one instance of the class and connect to the database and then
declare a second instance this second instance can issue commands
without having to connect. It seems to be able to use the first
classes connection.
This can cause big problems when using transaction. Suppose the
following:
Create instance S1 of the class
Connect to the databse with S1
Begin a transaction with S1
Insert using S1
Another client creates another isntance of the class called S2
S2 inserts into the database
S2 commits
S1 issues a rollback - this fails because the commit for s2 commited
this work because it uses the same connection.
This code is for the middle tier of an application using CORBA so it may be called by many clients - each with its own instance of my class. It is essential that I have a way to identify the database connection.
Is it possible to get a handle from the connection and then use this handle when I execute SQL queries?
How do you handle this?
Thanks,
Don dchamber_at_mindspring.comReceived on Mon May 15 2000 - 00:00:00 CDT