testdate表只有一个列:mydate
里边只有一条记录测试代码为:
private static void printDateTime()
{
PubDBBean pub = new PubDBBean();
Connection Conn=null;
Statement stm=null;
ResultSet rs=null;
String strDBValue=null;
try{
Conn = pub.getConnection();
if (Conn==null)
{
System.out.println("获取连接失败!");return;
}
String strCmdSQL="select mydate from testdate";
stm= Conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs=stm.executeQuery(strCmdSQL);
rs.last();

strDBValue = rs.getString("mydate");
System.out.println("显示直接返回的结果:"+strDBValue);

Date d;
d = rs.getDate("mydate");
System.out.println("显示转化后的结果:"+d.toString());

Conn.close();
}catch(Exception e)
{
System.out.println(e.getClass());
}
}打印出的调试结果为:
显示直接返回的结果:2006-08-12 00:00:00.0
显示转化后的结果:0001-12-01为什么会出现:0001-12-01的值?
同样的代码在Sybase ASE12下可以得出正确的值。大侠们帮帮忙,谢谢!