private void setSchemaOnConnection ( Connection connection ) throws SQLException { logger . finest ( "Entering " + CLASSNAME + ".setSchemaOnConnection()" ) ; String dbProductName = connection . getMetaData ( ) . getDatabaseProductName ( ) ; if ( ! "Oracle" . equals ( dbProductName ) && ! "Microsoft SQL Server" . equals ( dbProductName ) ) { PreparedStatement ps = null ; if ( "MySQL" . equals ( dbProductName ) ) { ps = connection . prepareStatement ( "USE " + schema ) ; } else { ps = connection . prepareStatement ( "SET SCHEMA ?" ) ; ps . setString ( 1 , schema ) ; } ps . executeUpdate ( ) ; ps . close ( ) ; } logger . finest ( "Exiting " + CLASSNAME + ".setSchemaOnConnection()" ) ; }
Set the default schema JBATCH or the schema defined in batch - config on the connection object .