cancel
Showing results for 
Search instead for 
Did you mean: 

table locking

werner_dornacher
Explorer
0 Kudos

Hi,

I'm coding an entitity bean. I've tried to use the SAP table locking API. Im sure to specify a valid database and a valid table name. But when I call the lock method I get a technicalLockexception : "table telefon not in catalog". What's the problem?

Here is my code:

if (lockConnection == null) {

lockConnection =

DriverManager.getConnection(

"jdbc:mysql://pc2079/was?user=root&password=pass");

}

if (initialContext == null) {

initialContext = new InitialContext();

}

if (locking == null) {

locking =

(TableLocking) initialContext.lookup(

TableLocking.JNDI_NAME);

}

Map pkMap = new HashMap();

pkMap.put("STAMMNR", new Integer( 3));

locking.lock(

TableLocking.LIFETIME_TRANSACTION,

lockConnection,

"telefon",

pkMap,

TableLocking.MODE_EXCLUSIVE_CUMULATIVE);

} catch (TechnicalLockException ex) {

return false;

} catch (LockException ex) {

return false;

} catch (Exception e) {

e.printStackTrace();

}

Tia.

Regards,

Werner

View Entire Topic
Former Member
0 Kudos

Hi Werner,

I'm a hundred percent sure that this is the problem, but I think that you need to get the database connection from a DataSource, which you have previously registered in JDBC Connector Service in the J2EE Engine.

Zornitsa

P.S. You can find more information about registering a DataSource at http://help.sap.com/saphelp_nw04/helpdata/en/c0/3ad4d5cdc66447a188b582aad537d3/frameset.htm

werner_dornacher
Explorer
0 Kudos

Hi Zornitsa,

Thanks for your help.

I'm getting the connection from a DataSource now, but I still get the same exception.

I'm using "Vendor SQL" as SQL provider because I'm getting an ArrayOutofBounds Exception when I try to use OpenSQL.

Regards

Werner

Message was edited by: Werner Dornacher

Former Member
0 Kudos

Hi Werner,

just an idea: All table locking examples i've seen so far did use the <b>upper case</b> name for tables. Maybe that's the reason for the error and specifying "TELEFON" instead of "telefon" for table name will fix it.

Hope that helps.

Regards

Stefan

werner_dornacher
Explorer
0 Kudos

Hi Stefan,

I changed the table name to upper case, and I still get the same Exception. Thanks for the help.

Regards

werner_dornacher
Explorer
0 Kudos

I can't find what's wrong. Please I really need help on this one. Do I need to define a DataDictionnary? Do I need specific parameters for my datasource.

Many thanks in advance.