This is similar to IBM Db2 net driver SQL error. Not finding table name? yet different.
I have a Spring boot JPA app that runs fine from my machine (embedded tomcat) using a datasource configuration
#spring.datasource.driver-class-name=com.ibm.db2.jcc.DB2Driver
#spring.datasource.url=jdbc:db2://**.***.***.209:50001/POTUSDB:securityMechanism=9;sslConnection=true;encryptionAlgorithm=2;sslTrustStoreLocation=/***/***/SSL_Certs/209/209.jks;sslTrustStorePassword=*****;
#spring.datasource.username=DB_USERNM
#spring.datasource.password=*******
However when I deploy in Websphere Applcn Server (WAS), and use a JNDI data source, I notice, the folowing error
ERROR - 28231 [WebContainer : 1] o.h.engine.jdbc.spi.SqlExceptionHelper - "SNEA_WPI.SNEA_AUTH" is an undefined name.. SQLCODE=-204, SQLSTATE=42704, DRIVER=4.25.25 ERROR - 28231 [WebContainer : 1] o.h.engine.jdbc.spi.SqlExceptionHelper - An error occurred during implicit system action type "2". Information returned for the error includes SQLCODE "-204", SQLSTATE "42704" and message tokens "SNEA_WPI.SNEA_AUTH".. SQLCODE=-727, SQLSTATE=56098, DRIVER=4.25.25
Previously my entity class was annotated with the schema as part of table annotation. When I dropped that and changed it to: @Table(name = "SNEA_AUTH") I see:
ERROR - 28231 [WebContainer : 7] o.h.engine.jdbc.spi.SqlExceptionHelper - "DB_USERNM.SNEA_AUTH" is an undefined name.. SQLCODE=-204, SQLSTATE=42704, DRIVER=4.25.25 ERROR - 28231 [WebContainer : 7] o.h.engine.jdbc.spi.SqlExceptionHelper - An error occurred during implicit system action type "2". Information returned for the error includes SQLCODE "-204", SQLSTATE "42704" and message tokens "DB_USERNM.SNEA_AUTH".. SQLCODE=-727, SQLSTATE=56098, DRIVER=4.25.25
As I can run my services and CRUD operations from local, the only way I could replicate this name not found issue in DB2 was changing and running the hibernate query in Squirrel SQL by enclosing the "schmaname.table_name" combination in double quotes.
That causes DB2 to be unable to distinguish between the two tokens.
My blocker is why this is happening on WAS server when using jndi data source or even spring datasource properties. while working as expected on local using spring datasource.
Current props:
spring.datasource.jndi-name=jdbc/potusdb
spring.jpa.properties.hibernate.default_schema=SNEA_WPI
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.database-platform=org.hibernate.dialect.DB2Dialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.DB2Dialect
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.show_sql=true