Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2014-09-18T14:38:14Z by MatthewWebster
SystemAdmin
SystemAdmin
260 Posts
ACCEPTED ANSWER

Pinned topic Connect to DB2 from java thread

‏2009-01-21T12:20:42Z |
I'm trying to open a connection to DB2 in java thread under CICS:

try {
final String jdbcUrl = "jdbc:default:connection";

fConnection = DriverManager.getConnection(jdbcUrl);
fConnection.setAutoCommit(false);
}
catch (Exception e) {System.err.print("Exception: " + e); e.printStackTrace(); }

Got the following error:

Exception: com.ibm.db2.jcc.t2zos.ab: IBM/DB2http://T2zos/2.10.113T2zosCicsApi.check
ApiStatus:Thread is not CICS-DB2 compatible: CICS_REGION_BUT_API_DISALLOWEDcom.i
bm.db2.jcc.t2zos.ab: IBM/DB2http://T2zos/2.10.113T2zosCicsApi.checkApiStatus:Thread
is not CICS-DB2 compatible: CICS_REGION_BUT_API_DISALLOWED
at com.ibm.db2.jcc.t2zos.y.a(y.java:40)
at com.ibm.db2.jcc.t2zos.y.a(y.java:118)
at com.ibm.db2.jcc.t2zos.k.c(k.java:421)
at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:725)
at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:645)
at com.ibm.db2.jcc.t2zos.T2zosConnection.<init>(T2zosConnection.java:548
)
at com.ibm.db2.jcc.t2zos.T2zosConnection.a(T2zosConnection.java:242)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:230)
at java.sql.DriverManager.getConnection(DriverManager.java:539)
at java.sql.DriverManager.getConnection(DriverManager.java:211)

Does it mean, that i cannot use multiple Db2 connections under different java threads?

Thank you.
  • Alexisss
    Alexisss
    1 Post
    ACCEPTED ANSWER

    Re: Connect to DB2 from java thread

    ‏2014-09-09T12:50:07Z  in response to SystemAdmin

    Hi, 

    did you resolve your trouble ? I got the same exception.

     

    Thank you in advance

  • MatthewWebster
    MatthewWebster
    1 Post
    ACCEPTED ANSWER

    Re: Connect to DB2 from java thread

    ‏2014-09-18T14:38:14Z  in response to SystemAdmin

    How did you create the thread? You can only access CICS services i.e. JCICS API and DB2 using a thread that CICS created i.e. the thread that called your main() method. Otherwise you must use a StartRequest or the CICSExecutorService.

     

    Cheers