SQLServer date / timestamp problems ?
Hi,
I am having trouble reading a timestamp field from sql server. Java 1.3/SQLServer 7 SP1, ODBC:JDBC bridge
We can access other datatypes OK but get the error
[Microsoft][ODBC SQL Server Driver]Restricted data type attribute violation
when we try to read a timestamp or datetime value, using getTimestamp or getDate.
Can anyone explain this error ?
java.sql.Date myDate;
java.sql.Timestamp myTimestamp;
java.util.Calendar cal = java.util.Calendar.getInstance();
java.util.TimeZone tz = java.util.TimeZone.getTimeZone("GMT");
String d;
try{
myTimestamp = r.getTimestamp("fldDate", cal);
System.out.println("Got timestamp");
System.out.println("timestamp is "+myTimestamp.toString() );
}
catch( SQLException e) {
System.out.println("Timestamp failed"+e);
}
try{
myDate = r.getDate("fldDate");
d=myDate.toString();
System.out.println("Date :"+d);
}
catch( SQLException e) {
System.out.println("Date failed"+e);
}

