Here is a good challenge. I have a program which needs to update a column - DATE type in Oracle, datetime type in SQL Server. I currently am able to get the newDate, with proper value, from this piece of code:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
long time= System.currentTimeMillis();
java.sql.Date systemsqldate=new java.sql.Date(time);
java.util.Date dateString=(java.util.Date)systemsqldate;
String newDate = null;
newDate = sdf.format(dateString); to look fine in SQL Server. In Oracle I get the infamous ORA-01861: literal does not match format string. I really want this program to function by just switching drivers and connection statements. I do not want to parse actual code based upon the DB. Just for additional color, It will also need to work with DB2.
Any great minds out there that have successfully faced this one?
[ March 18, 2004: Message edited by: Carty Ellis ]
I am using PreparedStatement to avoid DB sensitive issues - but it isn't working that way. [ March 18, 2004: Message edited by: Carty Ellis ]