Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / Ingres Topics / June 2004

Tip: Looking for answers? Try searching our database.

insertion of date in ingres

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
malti - 24 Jun 2004 20:34 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.