Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Warning with Spring boot and Sybase

I am getting a lot of SQL Warning in the logs with the spring boot and sybase.

o.h.engine.jdbc.spi.SqlExceptionHelper   : [] SQL Warning Code: 0, SQLState: 010SK 
o.h.engine.jdbc.spi.SqlExceptionHelper   : [] 010SK: Database cannot set connection option SET_READONLY_TRUE. 
  
    
o.h.engine.jdbc.spi.SqlExceptionHelper   : [] 010SK: Database cannot set connection option SET_READONLY_FALSE.

Could anyone explain the reason behind this?

like image 267
Chandresh Mishra Avatar asked Aug 11 '26 10:08

Chandresh Mishra


1 Answers

Solution 1:

java.sql.Connection has a setReadOnly(boolean) method that is meant to notify the database of the type of result set being requested in order to perform any optimizations. However Sybase ASE doesn't require any optimizations, therefore setReadOnly() produces a SQLWarning.

In order to suppress the message you'll need to update the spt_mda table in the MASTER database.

update spt_mda set querytype = 4, set query = '0'
where mdinfo = 'SET_READONLY_FALSE'

and

update spt_mda set querytype = 4, set query = '0'
where mdinfo = 'SET_READONLY_TRUE'

These two entries (they are the only ones) are set to a querytype of 3 by default, which means "not supported", which explains the SQLWarning.

Changing them to a 4 (meaning boolean values) with a query type of "0" basically causes the JDBC Driver to return false without the warning..

Solution 2:

You might turn off/on on logging for specific part of hibernate logging modules, these are different configurations:

 # Hibernate logging
# Log everything (a lot of information, but very useful for troubleshooting)
log4j.logger.org.hibernate=FATAL
# Log all SQL DML statements as they are executed
log4j.logger.org.hibernate.SQL=INHERITED
# Log all JDBC parameters
log4j.logger.org.hibernate.type=INHERITED
# Log all SQL DDL statements as they are executed
log4j.logger.org.hibernate.tool.hbm2ddl=INHERITED
# Log the state of all entities (max 20 entities) associated with the session at flush time
log4j.logger.org.hibernate.pretty=INHERITED
# Log all second-level cache activity
log4j.logger.org.hibernate.cache=INHERITED
# Log all OSCache activity - used by Hibernate
log4j.logger.com.opensymphony.oscache=INHERITED
# Log transaction related activity
log4j.logger.org.hibernate.transaction=INHERITED
# Log all JDBC resource acquisition
log4j.logger.org.hibernate.jdbc=INHERITED
# Log all JAAS authorization requests
log4j.logger.org.hibernate.secure=INHERITED

Possible values:

OFF     
FATAL   
ERROR   
WARN    
INFO    
DEBUG   
TRACE   
ALL     
like image 151
Yassine Avatar answered Aug 13 '26 01:08

Yassine