Dear All
I am having problems inserting date into ingres database throug jdbc.
When I execute sql query "insert into tablename(col)
values('06-12-2004') within the database it gets executed. But when I
run the same query from my java program through jdbc I cannot execute
the insert query for date. Some one please help!!!
Malti
Mike Lay - 25 Jun 2004 12:27 GMT
> Dear All
>
[quoted text clipped - 3 lines]
> run the same query from my java program through jdbc I cannot execute
> the insert query for date. Some one please help!!!
What's the error message?
Try "values(date('06-12-2004'))"

Signature
Mike Lay - Clinical Trial Service Unit
"I can barely speak for myself, let alone the CTSU"
w: http://www.ctsu.ox.ac.uk/
e: michael dot lay at ctsu (with an ox, an ac, and an uk on the end).
Piotr Lipski - 26 Jun 2004 17:32 GMT
> I am having problems inserting date into ingres database throug jdbc.
> When I execute sql query "insert into tablename(col)
> values('06-12-2004') within the database it gets executed. But when I
use JDBC escape syntax
(http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/statement.html#999472):
st.execute("insert into t1 values ({d '2004-12-06'})");
or prepared statement:
PreparedStatement ps = cn.prepareStatement("insert into t1 values
(?)");
ps.setDate(1, new java.sql.Date(new GregorianCalendar(2004, 12,
06).getTimeInMillis()));
Piotr Lipski