-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set Schema not workling on postgresql DB #23
Comments
some more infos the result query on postgresql: Not working: Working: Working to: |
Thanks for the report, @figolino. Some related issues were also reported here: Also, overlaps discussion in issue #11, where @smillidge has started down the path of subclassing At this point, I don't test with postgresql, so I'm not going to be looking into this myself. But if someone wants to send me a pull request and vouch for it working (or even go further and add test config), I'd be happy to consider adding more special-case logic, like we did for Oracle in 52a51e0. (Please note the CLA required for contributions). |
Ok send you the CLA |
@figolino you can try Payara ( a supported GlassFish) http://www.payara.co/upstream_builds the pre-release builds should have working Postgres JBatch support although it's still a work in progress. |
Hi I’m using jBatch on glassfish 4.1 release and I get a problem to use jBatch with postgresql DB.
The fix is simple replace prepared statement with normal SQL statement in the “JDBCPersistenceManagerImpl”
I guess this will fix also problems on MySQL Oracle …… since there are different bug reports around… on Glassfish JIRA to….
Old code
PreparedStatement ps = null;
ps = connection.prepareStatement("SET SCHEMA ?");
ps.setString(1, schema);
ps.executeUpdate();
New code
/**
Set the default schema JBATCH or the schema defined in batch-config on the connection object.
@param connection
@throws SQLException
*/
private void setSchemaOnConnection(Connection connection) throws SQLException {
logger.finest("Entering " + CLASSNAME +".setSchemaOnConnection()");
final Statement stmt = connection.createStatement();
stmt.execute("SET SCHEMA '"+schema+"'");
stmt.close();
logger.finest("Exiting " + CLASSNAME +".setSchemaOnConnection()");
}
Then I startet to test the new version of the jBatch FW 1.0.1 and I found some more problems on postgresql.
Only valid for latest master version!
Old code
private long createRuntimeJobExecutionEntry(JobInstance jobInstance, Properties jobParameters, BatchStatus batchStatus, Timestamp timestamp) {
……
…
new code note jobexecid is lover case this is only a quick fix real fix wood by to not use prepared statement here since with prepared statement in the result query the JOBEXECID is quoted “JOBEXECID”
statement = conn.prepareStatement("INSERT INTO executioninstancedata (jobinstanceid, createtime, updatetime, batchstatus, parameters) VALUES(?, ?, ?, ?, ?)", new String[] { "jobexecid" });
same for to:
statement = conn.prepareStatement(query, new String[] { "STEPEXECID" });
and
statement = conn.prepareStatement("INSERT INTO jobinstancedata (name, apptag) VALUES(?, ?)", new String[] { "JOBINSTANCEID" } );
The text was updated successfully, but these errors were encountered: