Description:
I use mysql-4.0.25-win32.
I have a column in my database with the Datatype called Timestamp(14).
When I use the driver: mysql-connector-java-3.0.15-ga-bin, and try to get the Timestamp as following:
String jobStartTimestamp = rs.getString("jobStartTimestamp");
- I have no problems. When I print out the String jobStartTimestamp I get the format: 20050905120000, as expected.
But when I use the the driver: mysql-connector-java-3.1.10-bin, I recieve the Timestamp format as 2005-09-05 12:00:00.0
Is that a bug or do I have to change all my code?
How to repeat:
Create the table:
CREATE TABLE `job` (
`jobID` int(11) NOT NULL auto_increment,
`jobName` varchar(100) NOT NULL default '',
`jobClass` varchar(100) NOT NULL default '',
`jobStartTimestamp` timestamp(14) NOT NULL,
`jobRollTimestamp` timestamp(14) NOT NULL default '00000000000000',
`jobRoll` int(11) NOT NULL default '0',
`jobRollCounter` int(11) NOT NULL default '0',
`jobIsActive` tinyint(1) NOT NULL default '0',
`compID` int(10) NOT NULL default '0',
PRIMARY KEY (`jobID`)
) TYPE=MyISAM;
//RUN THE QUERY
stat = conn.prepareStatement("SELECT job.jobID, job.jobClass, job.jobStartTimestamp,job.jobRollTimestamp, job.jobRoll, job.jobRollCounter, job.jobIsActive FROM job");
rs = stat.executeQuery();
while ( rs.next() ){
int jobID = rs.getInt("jobID");
String jobClass = rs.getString("jobClass");
String jobStartTimestamp = rs.getString("jobStartTimestamp");
String jobRollTimestamp = rs.getString("jobRollTimestamp");
int jobRollTimeType = rs.getInt("jobRoll");
int jobRollCounter = rs.getInt("jobRollCounter");
int jobIsActive = rs.getInt("jobIsActive");
}
rs.close();