[Reprinted from Flywind63 Blog] Microsoft's SQL Server JDBC Drive Problem: ResultSet Can Not Re-Read Row

xiaoxiao2021-03-06  56

Microsoft saw this title and is definitely not happy. However, in business applications, there are very few companies that are really practical to Microsoft, what com.microsoft.jdbc.sqlserver.sqlserverDriver.

In fact, it is also a chance to discover the shortage of Microsoft's drive. In a transplant application, the system reports [Microsoft] [SQLServer JDBC Driver] ResultSet Can Not Re-Read Row Data for Column. In order to solve this error, the tracker is busy for a long time, and there is no problem. You can only determine that an error will occur when rs.getstring ("xxx") (RS is the Resultset object). Then simulate the following environment: Database table: TestTable Table field and type: Guid Char (38) Title Varchar (100) Content Text Username VARCHAR (20) Query SQL Statement: Select GUID, Username, Content, Title From Testtable Where ···· Java code: rs.getstring ("guid"); rs.getbinaryStream ("content"); rs.getstring ("username"); ---------------- -------------------------------------------

The code above is very uncomfortable. With Microsoft's drive, it will inevitably report an error (that is, the error above). If you track, it is inevitably this line: rs.getstring ("UserName") throws an error.

So, if you use rs.getstring ("username") and RS.GetBinaryStream ("Content"); how to interchange it, it will be The result is that it can work normally.

Why does this happen because Microsoft's drive is included in a field containing the BLOB or Clob (that is, Image and Text Types). Then you must query in Select, and you do not support repeated queries.

In the face of this situation, only the replacement is driven. A lot of driving abroad, such as JSQLConnect, JTURBO, and more. These are commercial, need to pay, not enough to have a trial version. If you want to have a free, get a free on www.freetds.com (I have not tested this free driver, I don't know if this situation will exist). For the initial instructions, you can refer to [JavaSearch] http://www.javaresearch.org/Article/showArticle.jsp?column=2&thread=4278] or [Javaunion] (unfortunately, Javaunion has not existed) HTTP: //www.javaunion.org/bbs/cgi-bin/topic.cgi?forum=1&topic=15516&show=0

In fact, this document I want to say today is really old. As early as Javaunion, I talked about this problem. Today, suddenly, it is only accidentally discovered that the "SQLSERVER2000 JDBC Drive" document in the database sector is discovered. I thought that there would be some stuff worth the reference, and the results are expected (the article is ideal for entry type reference, from this point written). However, in the commercial application, it is a bit naive. I hope everyone can use it with caution or try not to use Microsoft's own SQLServer's JDBC driver. If you have any questions, or if there is a mistake, please ax. You can send an email, communicate with each other. Author: Silver Fox 999 (james999) mail: james-fly@vip.sina.com =============================== ================ Accept the BLUNDBLADE brothers, added as follows: (1) If you use JDBC-ODBC driver, then you must read it in the order of the query (no matter if it is image Or Text Type) (2) If Microsoft's MS SQL Server JDBC Driver is used, if there is no image or text type field, you can acquire (3) if you adopt Microsoft MS SQL Server JDBC Driver If the query statement exists, there is an Image or Text type field, then it must be read in order, otherwise the DRIVER] ResultSet Can not Re-Read Row Data for Column is wrong (4) If you want to query the statement There is no image or text type field, you can get it in order or repeat. Then you have to replace the driver, use a third party.

转载请注明原文地址:https://www.9cbs.com/read-113956.html

New Post(0)