1

I keep having the following error in MobileFirst Platform 6.3:

Runtime: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (DB2 SQL Error: SQLCODE=-142, SQLSTATE=42612, SQLERRMC=null, DRIVER=4.19.26)

This is my adapter code:

     var test2 = WL.Server.createSQLStatement("SELECT * FROM WSDIWC.WBPTRR1");

     function getCEID(cnum) {   
        return WL.Server.invokeSQLStatement({
            preparedStatement : test2,
            parameters : []
        });
     }

And adapter XML:

     <connectivity>
        <connectionPolicy xsi:type="sql:SQLConnectionPolicy">
        <!-- Example for using a JNDI data source, replace with actual data source 
            name -->
        <!-- <dataSourceJNDIName>${training-jndi-name}</dataSourceJNDIName> -->

        <!-- Example for using MySQL connector, do not forget to put the MySQL 
            connector library in the project's lib folder -->
         <dataSourceDefinition>
              <driverClass>com.ibm.db2.jcc.DB2Driver</driverClass>
               <url>jdbc:db2://***</url>
               <user>**</user>
                <password>**</password>
            </dataSourceDefinition>
        </connectionPolicy>
    </connectivity>

I have remove the url, user and password. Hope you help me out on clarification about the current problem.

I already know that the sql is not accepted since it's just a simple query.
I have also research about z/OS DB2 that it has issue with same error code sqlcode=-142. http://answers.splunk.com/answers/117024/splunk-db-connect-db2.html

0

2 Answers 2

0

While you say that this is a "simple query", the exception error code mentions the following:

-142
THE SQL STATEMENT IS NOT SUPPORTED

Explanation

An SQL statement was detected that is not supported by the database. The statement might be valid for other IBM® relational database products or it might be valid in another context. For example, statements such as VALUES and SIGNAL or RESIGNAL SQLSTATE can be used only in certain contexts, such as in a trigger body or in an SQL Procedure.

System action
The statement cannot be processed.

Programmer response
Change the syntax of the SQL statement or remove the statement from the program.

You should review the DB2 SQL guidelines for how to achieve what you want to achieve, and also explain that in the question if you'd like further assistance. For example, are you sure "WSDIWC.WBPTRR1" is actually available?

1
  • It work in data studio . I have check it dozen times. All my query work in data studio. My other team try it also but they get the same error message. Thanks for your help . Jan 6, 2015 at 7:27
0

I encountered this same problem with JDBC connections to mainframe DB2 in MobileFirst 6.3. Connections to DB2 LUW worked fine. It appears that default pool validationQuery is valid for DB2 LUW but not DB2 z/OS.

You can work around the bug by doing the data source configuration in the Liberty profile server.xml. From the Eclipse Servers view, expand MobileFirst Development Server and edit the Server Configuration. Add the driver and data source there; for example:

 <library id="db2jcc">
    <fileset dir="whereever" includes="db2jcc4.jar db2jcc_license_cisuz.jar"/>
 </library>
 <dataSource id="db2" jndiName="jdbc/db2">
    <jdbcDriver libraryRef="db2jcc"/>
    <properties.db2.jcc databaseName="mydb" portNumber="5021" 
        serverName="myserver" user="myuser" password="mypw" />
 </dataSource>

Then reference it in your adapter XML under connectionPolicy:

 <dataSourceJNDIName>jdbc/db2</dataSourceJNDIName> 

A benefit of configuring data sources in server.xml (vs the adapter XML) is you have access to all data source, JDBC, and JCC properties. So if the connection pool gives you other problems, you can customize it or switch to another data source type, such as type="javax.sql.DataSource".

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.