cicsdev / cics-java-liberty-springboot-jdbc

Java™ Spring Boot application demonstrating how to use the Spring Boot JdbcTemplate in CICS® Liberty

Home Page:https://developer.ibm.com/tutorials/spring-boot-java-applications-for-cics-part-4-jdbc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

schema name DSN81110 is not getting passed from properties.db2.jcc parm

ebarkow opened this issue · comments

I am running on CICS TS 5.4 and the schema name is not being passed from
properties.db2.jcc parm. aux trace shows username.EMP is trying to be accessed, not
dsn81110.emp.

Now i tried a few things like modifying EmployeeService.java to hard code SELECT * FROM DSN81110.EMP and coding jdbcTemplate.execute("SET CURRENT SCHEMA DSN81110") but those just led to other errors like org.springframework.jdbc.UncategorizedSQLException

is there anyway to fix this?

thanks in advancel

error in log shows:
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][50053][12311][4.28.11] T2zOS exception: [jcc][T2zos]T2zosStatement.readExecuteImmediate:nativeExecuteImmediate:968: DB2 engine SQL error, SQLCODE = -713, SQLSTATE = 3F000, error tokens = CURRENT SCHEMA ERRORCODE=-713, SQLSTATE=3F000

cics aux trace shows:
*. *
4-0000 E2D8D3C3 C1404040 00000088 FFFFFF34 000CC3C9 C3E2E4E2 C5D94BC5 D4D74040 *SQLCA ...h......CICSUSER.EMP *
0020 40404040 40404040 40404040 40404040 40404040 40404040 40404040 40404040 * *
0040 40404040 40404040 40404040 40404040 40404040 40404040 C4E2D5E7 D6E3D340 * DSNXOTL *
0060 FFFFFE0C 00000000 00000000 FFFFFFFF 00000000 00000000 40404040 40404040 *........................ *
0080 404040F4 F2F7F0F4 * 42704 *

server.xml datasource:

I had to change jndi name to defaultCICSDataSource in server.xml and application.properties

	<properties.db2.jcc currentSchema="dsn81110" driverType="2"/>

	<connectionManager agedTimeout="0"/>
</dataSource>

fyijdbc info********************
DSRA7014I: The DB2 Universal JDBC driver runs in a RRS environment
[6/14/21 15:59:48:312 GMT] 00000043 SystemOut O 2021-06-14 15:59:48.311 INFO 16777830 --- [RVICE_Thread-26] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
[6/14/21 15:59:49:125 GMT] 00000043 com.ibm.ws.rsadapter.impl.DatabaseHelper I DSRA8203I: Database product name : DB2
[6/14/21 15:59:49:126 GMT] 00000043 com.ibm.ws.rsadapter.impl.DatabaseHelper I DSRA8204I: Database product version : DSN12015
[6/14/21 15:59:49:126 GMT] 00000043 com.ibm.ws.rsadapter.impl.DatabaseHelper I DSRA8205I: JDBC driver name : IBM Data Server Driver for JDBC and SQLJ
[6/14/21 15:59:49:126 GMT] 00000043 com.ibm.ws.rsadapter.impl.DatabaseHelper I DSRA8206I: JDBC driver version : 4.28.11

i got around the problem by removing the currentSchema parm from properties.db2.jcc and coding a set current schema in each method of EmployeeService.java:
String qs ="SET CURRENT SCHEMA = 'DSN81110'";
jdbcTemplate.execute(qs);