Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data visibility across weblogic and jdbc connection

Status
Not open for further replies.

pranavsingh

Programmer
Apr 19, 2002
8
0
0
IN
Hi
I have a user managed transaction.
I am inserting a record in database using a weblogic connection (ejbCreate method of CMP Bean).
In the same transaction, I open a JDBC connection from the same class.
I am trying to access the records inserted using the weblogic connection through the JDBC connection.
I am not able to view the records in the JDBC connection.

Is there a way to make the data visible to the JDBC connection as well.

Thanks,
Pranav

 
Why do you need to access the data from your standalone JDBC connection, rather than using the getter method from the EJB ? This kind of misses the point of EJB surely ?

If you are doing this simulataneously, then the CMP bean may not have inserted the data by the time your standalone JDBC connection executes your SQL.
 
I need to return an array of database objects from the database to java. Thats why I am using JDBC connection as it is not possible to do so through weblogic connection.

The operation is not happening simultaneously. The sql read is executed after the record is inserted into database by CMP bean using weblogic connection.

Thanks for the reply.
 
Remember that the "weblogic connection" is also a JDBC connection.

When you say "I am not able to view the records in the JDBC connection." - how do you mean ? Is it a permissions thing, ie not connectiing as a user that can view the relevant tables ? Can you log into the db via a console like SQLPlus, and then do some basic SQL against the releavant tables, like "desc table_a" etc ?

>>>> I need to return an array of database objects from the database to java

Why can you not use blobs, or arrays of blobs ? SQL-JDBC mapping supports the transer of arrays, or VARRAY objects using the STRUCT mechanism ....
 
>>I am inserting a record in database using a weblogic connection (ejbCreate method of CMP Bean).
>>In the same transaction, I open a JDBC connection from the same class.

?? It is not visible because you haven't committed yet. ??
?? Does this depend on the isolation level ??
[ just guessing ]
 
The JDBC connection is also using the same user, password, datasourcename as the weblogic connection.

Also, I have tried the isolation level. I changed it to Transaction_Read_Uncommited but it resulted in an error :

<Nov 27, 2003 2:33:07 PM GMT+05:00> <Info> <EJB> <EJB Exception during invocation from home: svm.eug.ejb.SessionEUGEJB_q4q24v_HomeImpl@6d569b threw exception: javax.ejb.EJBException
- with nested exception:
[java.sql.SQLException: READ_COMMITTED and SERIALIZABLE are the only valid transaction levels]
java.sql.SQLException: READ_COMMITTED and SERIALIZABLE are the only valid transaction levels
...
...

Following is the pseudocode of what I am doing:

Begin User Transaction;
Call ejbCreate() method of CMP Bean (Insert record in database);
Open JDBC connection(user name, password, driver, datasource);
read record from database using JDBC connection
(This read does not return the inserted data through ejbCreate())
End User Transaction;


I tried opening another weblogic connection in place of JDBC connection and I could see the data inserted by ejbCreate(). The same does not happen with JDBC connection.

I am tryinng with BLOB but this would require major changes in my implementation. So if the JDBC could work that would be best.

Thanks for your replies.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top