[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [xmlblaster] possible problem about JDBC Driver

After examining the DBAdapterUtils.java, I find the problem is the following codes:

case Types.TIMESTAMP:
columnValue = rs.getTimestamp(i).toString();

When changed to the following code, it works fine.

case Types.TIMESTAMP:
Timestamp ts=rs.getTimestamp(i);
if (ts==null) columnValue="null" ; else columnValue=ts.toString();

althrough this bug is fixed, other possible NULL values may exist. So If it's necessary to change all the case codes to the above style? please verify this!!!

by the way, the datetime in SQLServer is mapped to TIMESTAMP, so if 2002-11-11 in SQLServer, the output is "2004-11-24 00:00:00.0"
how to fix this problem? just trim the thanks a lot!

From: "zhang zhi wei" <zzwzyz at hotmail.com>
Reply-To: xmlblaster at server.xmlBlaster.org
To: xmlblaster at server.xmlblaster.org
Subject: [xmlblaster] possible problem about JDBC Driver
Date: Tue, 20 Apr 2004 20:44:53 +0800


A possible bug is discovered!

Use the JDBC Driver to query a database table, where the colum in the table can be NULL value-assigned.
The data in this colum is NULL.
Use the SELECT type query SQL to query the underground database, it report error!

[2004-4-20 20:06:14 ERROR DBAdapterUtils] Error in scanning result set for 'FQSMD':
errorCode=legacy message=Error in scanning result set for 'FQSMD': null
at org.xmlBlaster.protocol.jdbc.DBAdapterUtils.createDocument(DBAdapterUtils.java:188)

at org.xmlBlaster.protocol.jdbc.XmlDBAdapter.queryDB(XmlDBAdapter.java:209)
at org.xmlBlaster.protocol.jdbc.XmlDBAdapter.query(XmlDBAdapter.java:149)
at org.xmlBlaster.protocol.jdbc.XmlDBAdapterWorker.run(XmlDBAdapterWorker.java:73)

[2004-4-20 20:06:14 ERROR XmlDBAdapter] Unexpected exception in query 'select *
from CarTechDoc' : errorCode=legacy message=Error in scanning result set for 'FQSMD': null: We destroy the connection in case it's stale

I think the reason is DBAdapterUtils doesnot handle the possible NULL value problem. The FQSMD field is a date field

免费下载 MSN Explorer:   http://explorer.msn.com/lccn/

与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn