Organizational Research By

Surprising Reserch Topic

a datetime equivalent in java sql is there a java sql datetime using -'java,mysql,sql,datetime,jdbc'


a datetime equivalent in java sql is there a java sql datetime  using -'java,mysql,sql,datetime,jdbc'

So far, I have not found a clear answer to this.

I'd like to know what the equivalent is for a SQL type DATETIME and the java type, using a PreparedStatement.

I have found: http://www.java2s.com/Code/Java/Database-SQL-JDBC/StandardSQLDataTypeswithTheirJavaEquivalents.htm

But it states that SQL type "DATETIME" is the same as sql.date, but when looking at the SQL date docs (http://download.oracle.com/javase/7/docs/api/java/sql/Date.html), it says the time is truncated (all zeros).

What I want is to be able to specify a preparedStatement.setDateTime() or some sort.

The only other way I see is using a timestamp, but that would require me to change the column type, while I cannot imagine someone else never had this problem before?

Any hints?

Edit: I am using MYSQL.
    
asked Sep 7, 2015 by rajesh
0 votes
8 views



Related Hot Questions



Government Jobs Opening


...