PutSQL and AutoCommit Mode Still Commits

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

PutSQL and AutoCommit Mode Still Commits

Shawn Weeks

It appears that PutSQL calls a commit even when set to autoCommit true mode. This breaks things if a driver raises an error on commit in autoCommit mode. For example redshift does this.

 

Thanks

Shawn

 

 

Reply | Threaded
Open this post in threaded view
|

Re: PutSQL and AutoCommit Mode Still Commits

Shawn Weeks

Per the JDBC Spec calling commit() on a connection in auto-commit should raise a SQLException so what we’re doing is out of spec.

 

https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#commit()

 

We should probably check c.getProperty(AUTO_COMMIT).asBoolean() and only call commit if we weren’t in auto commit mode. I’ll file a jira

 

Thanks

Shawn

 

From: Shawn Weeks <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Wednesday, June 3, 2020 at 2:27 PM
To: "[hidden email]" <[hidden email]>
Subject: PutSQL and AutoCommit Mode Still Commits

 

It appears that PutSQL calls a commit even when set to autoCommit true mode. This breaks things if a driver raises an error on commit in autoCommit mode. For example redshift does this.

 

Thanks

Shawn

 

 

Reply | Threaded
Open this post in threaded view
|

Re: PutSQL and AutoCommit Mode Still Commits

Juan Pablo Gardella
Which driver?

On Wed, 3 Jun 2020 at 17:20, Shawn Weeks <[hidden email]> wrote:

Per the JDBC Spec calling commit() on a connection in auto-commit should raise a SQLException so what we’re doing is out of spec.

 

https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#commit()

 

We should probably check c.getProperty(AUTO_COMMIT).asBoolean() and only call commit if we weren’t in auto commit mode. I’ll file a jira

 

Thanks

Shawn

 

From: Shawn Weeks <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Wednesday, June 3, 2020 at 2:27 PM
To: "[hidden email]" <[hidden email]>
Subject: PutSQL and AutoCommit Mode Still Commits

 

It appears that PutSQL calls a commit even when set to autoCommit true mode. This breaks things if a driver raises an error on commit in autoCommit mode. For example redshift does this.

 

Thanks

Shawn

 

 

Reply | Threaded
Open this post in threaded view
|

Re: PutSQL and AutoCommit Mode Still Commits

Shawn Weeks

https://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html#download-jdbc-driver

 

https://s3.amazonaws.com/redshift-downloads/drivers/jdbc/1.2.43.1067/RedshiftJDBC42-no-awssdk-1.2.43.1067.jar

 

Thanks

 

From: Juan Pablo Gardella <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Wednesday, June 3, 2020 at 3:29 PM
To: "[hidden email]" <[hidden email]>
Subject: Re: PutSQL and AutoCommit Mode Still Commits

 

Which driver?

 

On Wed, 3 Jun 2020 at 17:20, Shawn Weeks <[hidden email]> wrote:

Per the JDBC Spec calling commit() on a connection in auto-commit should raise a SQLException so what we’re doing is out of spec.

 

https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#commit()

 

We should probably check c.getProperty(AUTO_COMMIT).asBoolean() and only call commit if we weren’t in auto commit mode. I’ll file a jira

 

Thanks

Shawn

 

From: Shawn Weeks <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Wednesday, June 3, 2020 at 2:27 PM
To: "[hidden email]" <[hidden email]>
Subject: PutSQL and AutoCommit Mode Still Commits

 

It appears that PutSQL calls a commit even when set to autoCommit true mode. This breaks things if a driver raises an error on commit in autoCommit mode. For example redshift does this.

 

Thanks

Shawn

 

 

Reply | Threaded
Open this post in threaded view
|

Re: PutSQL and AutoCommit Mode Still Commits

Shawn Weeks
In reply to this post by Juan Pablo Gardella

Specifically try adding a partition to an external table aka RedShift Spectrum which can’t be execute in a transaction.

 

Thanks

 

From: Juan Pablo Gardella <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Wednesday, June 3, 2020 at 3:29 PM
To: "[hidden email]" <[hidden email]>
Subject: Re: PutSQL and AutoCommit Mode Still Commits

 

Which driver?

 

On Wed, 3 Jun 2020 at 17:20, Shawn Weeks <[hidden email]> wrote:

Per the JDBC Spec calling commit() on a connection in auto-commit should raise a SQLException so what we’re doing is out of spec.

 

https://docs.oracle.com/javase/7/docs/api/java/sql/Connection.html#commit()

 

We should probably check c.getProperty(AUTO_COMMIT).asBoolean() and only call commit if we weren’t in auto commit mode. I’ll file a jira

 

Thanks

Shawn

 

From: Shawn Weeks <[hidden email]>
Reply-To: "[hidden email]" <[hidden email]>
Date: Wednesday, June 3, 2020 at 2:27 PM
To: "[hidden email]" <[hidden email]>
Subject: PutSQL and AutoCommit Mode Still Commits

 

It appears that PutSQL calls a commit even when set to autoCommit true mode. This breaks things if a driver raises an error on commit in autoCommit mode. For example redshift does this.

 

Thanks

Shawn