今天遇到了这个异常
java.sql.SQLException: Fail to convert to internal representation at oracle.jdbc.driver.CharCommonAccessor.getLong(CharCommonAccessor.java:297) at oracle.jdbc.driver.T4CVarcharAccessor.getLong(T4CVarcharAccessor.java:849) at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:939) at oracle.jdbc.driver.OracleResultSet.getLong(OracleResultSet.java:440) at com.alibaba.druid.pool.DruidPooledResultSet.getLong(DruidPooledResultSet.java:304) at cn.egame.data.core.rowmapper.js.OpenChannelSettlementsRowMapper.mapRow(OpenChannelSettlementsRowMapper.java:21) at cn.egame.data.core.rowmapper.js.OpenChannelSettlementsRowMapper.mapRow(OpenChannelSettlementsRowMapper.java:14)
java代码
bean.setDistributorId(rs.getLong("distributor_id"));
这里数据库中distributor_id为varchar2,用getLong去出来
此问题非必现,查看数据也没问题
来查看下各个类的源码(反编译的,此包非开源)
OracleResultSetImpl
public synchronized long getLong(int var1) throws SQLException { if(var1 <= 0 || var1 > this.statement.numberOfDefinePositions) { DatabaseError.throwSqlException(3); } if(this.closed) { DatabaseError.throwSqlException(11); } int var2 = this.statement.currentRow; if(var2 < 0) { DatabaseError.throwSqlException(14); } this.statement.lastIndex = var1; if(this.statement.streamList != null) { this.statement.closeUsedStreams(var1); } //T4CVarcharAccessor.getLong return this.statement.accessors[var1 - 1].getLong(var2); }
几个类的关系如下
T4CVarcharAccessor extends VarcharAccessor extends CharCommonAccessor
如下是CharCommonAccessor.getLong方法
long getLong(int var1) throws SQLException { long var2 = 0L; if(this.rowSpaceIndicator == null) { DatabaseError.throwSqlException(21); } if(this.rowSpaceIndicator[this.indicatorIndex + var1] != -1) { try { var2 = Long.parseLong(this.getString(var1).trim()); } catch (NumberFormatException var5) { DatabaseError.throwSqlException(59); } } return var2; }
反编译代码如下
/* */ long getLong(int paramInt)
/* */ throws SQLException
/* */ {
/* 273 */ long l = 0L;
/* */
/* 275 */ if (this.rowSpaceIndicator == null)
/* */ {
/* 279 */ SQLException localSQLException1 = DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 21);
/* 280 */ localSQLException1.fillInStackTrace();
/* 281 */ throw localSQLException1;
/* */ }
/* */
/* 287 */ if (this.rowSpaceIndicator[(this.indicatorIndex + paramInt)] != -1)
/* */ {
/* */ try
/* */ {
/* 291 */ l = Long.parseLong(getString(paramInt).trim());
/* */ }
/* */ catch (NumberFormatException localNumberFormatException)
/* */ {
/* 296 */ SQLException localSQLException2 = DatabaseError.createSqlException(getConnectionDuringExceptionHandling(), 59);
/* 297 */ localSQLException2.fillInStackTrace();
/* 298 */ throw localSQLException2;
/* */ }
/* */
/* */ }
报错在297行,也就是
“java.sql.SQLException: Fail to convert to internal representation”
从291行看,网上搜到很多方法说将getLong变为getString,在数据为数字的情况下,个人觉得没有实际意义
相关推荐
NULL 博文链接:https://futeng.iteye.com/blog/1833449
May expose internal representation by incorporating reference to mutable object 描述:调用set方法,修改对象属性,被修改的对象属性是一个可变的对象; May expose internal representation by returning ...
Introduction to Lie algebras and representation theory (Springer,Third printing, revised, 1980)(T)(186s) - James E. Humphreys.djvu
模式识别和图像处理方面的好书,里面有很多实例和详细的公式推导。网上的正版图书越来越下不来了。
Ch4 Internal Representation of Files高级操作系统课件PPT(UNIX).ppt
Brown University教授著作,模式识别理论
see the definitions of "staged representation" and "continuous representation.", either continuous or staged, and you must determine the bodies of knowledge you want to include in the model your ...
models and argue that new theory from sparse signal representation offers the key to addressing this problem. Based on a sparse representation computed by‘ 1 -minimization, we propose a general ...
Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary ...
Learning Internal Representations by Error Progagation.pdf
We present a new compact but dense representation of scene geometry which is conditioned on the intensity data from a single image and generated from a code consisting of a small number of parameters....
Defining material coefficients of anisotropic yield function as scalar functions... To illustrate the capability of suggested representation, a numerical example about subsequent anisotropy is presented.
COBOL学习资料,第一次发帖。。。。。。
Abstract:In this paper, a new technique coined two-dimensional principal component analysis (2DPCA) is developed for image representation. As opposed to PCA, 2DPCA is based on 2D image matrices ...
In this paper, we utilize both large-scale textual corpora and KGs to train an enhanced language representation model (ERNIE), which can take full advantage of lexical, syntactic, and knowledge ...
AI and automation, programs that evangelize STEM education for the next generation, and organizations that battle for fair and diverse representation in STEM fields. We are committed to making a ...
介绍:Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. 压缩包里有以下文件: ...
texture, it has been widely applied to personal identification. But the spare representation based FKP method has not been reported yet. In this paper, a smooth l0 norm spare representation model ...
Abstract—The goal of knowledge representation learning is to embed entities and relations into a low-dimensional, continuous vector space. How to push a model to its limit and obtain better results ...
Nodes in graphs usually contain useful feature information that cannot be well addressed in most unsupervised representation learning methods (e.g., network embedding methods). Graph neural networks ...