Skip to content
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

Utc class should be removed #78

Open
Glusk opened this issue Dec 19, 2019 · 6 comments
Open

Utc class should be removed #78

Glusk opened this issue Dec 19, 2019 · 6 comments
Labels

Comments

@Glusk
Copy link
Contributor

Glusk commented Dec 19, 2019

Utc should be removed from source.

According to this SO answer, SQL timestamps should be set and queried via the Instant class:

If you were using java.sql.Timestamp to exchange data with a database, no need for that class anymore. As of JDBC 4.2 and later, you can directly exchange java.time objects with your database.

myPreparedStatement.setObject( … , instant ) ;

...and…

Instant instant = myResultSet.getObject( … , Instant.class ) ;

It should be documented in the README.md that one should work with Instant objects whenever trying to set or query a java.sql.Timestamp.

@0crat
Copy link

0crat commented Dec 19, 2019

@yegor256/z please, pay attention to this issue

@0crat
Copy link

0crat commented Dec 19, 2019

@glusk2/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!

@andreoss
Copy link
Collaborator

@yegor256 What do you think? With better JSR310 support, Utc wouldn't be necessary .

@yegor256
Copy link
Member

@Glusk @andreoss I agree. But we will have to release a new major version of jcab-jdbc, I believe.

@andreoss
Copy link
Collaborator

andreoss commented Jan 3, 2021

@Glusk
After looking into the details it appears that

  1. The current version of pgjdbc does not support Instant Additional jsr 310 support pgjdbc/pgjdbc#1325
  2. H2 does support Instant but only in the latest version
  3. MaridDB/MySQL Connector does not support Instant

@Glusk
Copy link
Contributor Author

Glusk commented Jan 3, 2021

@andreoss

Looking at this page, JDBC 4.2 spec seems to be supported by the most up to date Connector/J version.

This SO answer claims that there is support for Instant in pgjdbc

On the other hand I've also come across this:

FYI, Instant is not supported by JDBC at all.
From this comment

I clearly don't know enough about this.

@yegor256 yegor256 added the bug label Jun 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants