By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,940 Members | 611 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,940 IT Pros & Developers. It's quick & easy.

JDBC-ODBC date updates

P: n/a
I have a problem updating date values using Java via JDBC-ODBC to Access.

<snip
rs.updateTimestamp(theIndex,theTimeStamp);
rs.updateRow();
<snip>
(where theTimeStamp is a valid Java Timestamp and theIndex is the column
index in the resultset.)

is the way specified in the Java API. The (very non-specific) error reported
by the engine is simply 'Error in row'. !!

The timestamp parameter seems in order as it prints out a valid toString()
and the resultset cursor is fine too. How do you format this Timestamp to be
acceptable by Access?


Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
sun.jdbc.odbc.JdbcOdbcDriver is the driver I got with the SDK.

I've tried any kind of updateString you'd like (YYYY-MM-DD, YY-DD-MM, etc)
The Timestamp format sent back with a select query is
YYYY-DD-MM HH:MM:SS.M

Someone told me the update string should be between #'s but that also
didn't solve the problem.

I'm creating the Java timestamp with

theTimestamp = Timestamp.valueOf("1998-10-12 00:00:00.0");

and then follows
resultset.updateTimestamp(columnIndex,theTimestamp );
updateRow();

-C

"Steve Claflin" <Pi********@cs.compost> wrote in message
news:3F***************@cs.compost...
Dr X wrote:

I have a problem updating date values using Java via JDBC-ODBC to Access.
<snip
rs.updateTimestamp(theIndex,theTimeStamp);
rs.updateRow();
<snip>
(where theTimeStamp is a valid Java Timestamp and theIndex is the column
index in the resultset.)

is the way specified in the Java API. The (very non-specific) error reported by the engine is simply 'Error in row'. !!

The timestamp parameter seems in order as it prints out a valid toString() and the resultset cursor is fine too. How do you format this Timestamp to be acceptable by Access?


I'm surprised you found a driver that was JDBC 2 compliant, but you
would have most likely gotten a different error message if that was the
case. (What driver are you using?)

You might try formatting the time stamp as a string and using
updateString with it. That has worked for me in the past, although you
have to make sure that the string has the date in a format that access
will accept in your locale (view a timestamp in access and duplicate the
format).

--
Steve
--
http://www.steveclaflin.com

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.