今天遇到了这个异常
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,在数据为数字的情况下,个人觉得没有实际意义
相关推荐
《深入理解FindBugs:可能通过返回暴露内部表示——“NULL”问题分析》 在软件开发过程中,确保代码的质量和安全至关重要。FindBugs作为一款静态代码分析工具,能够帮助开发者在程序运行前发现潜在的问题。...
Introduction to Lie algebras and representation theory (Springer,Third printing, revised, 1980)(T)(186s) - James E. Humphreys.djvu
- **May expose internal representation by incorporating reference to mutable object**:调用set方法,修改对象属性,被修改的对象属性是一个可变的对象。 - **描述**:这通常意味着通过公共接口暴露了内部状态...
- **Pattern Theory: From Representation to Inference**:此书名明确指出本书的主题是模式理论,并且关注于模式从表示(representation)到推理(inference)的过程。这表明书中不仅会介绍模式的基本表示方法,还...
- **Pattern Theory From Representation to Inference**:本书标题明确地指出了其研究的主要领域——模式理论,并且强调了从模式的表示(representation)到模式的推理(inference)这一过程。这意味着书中将涵盖...
Ch4 Internal Representation of Files高级操作系统课件PPT(UNIX).ppt
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 ...
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....
在COBOL编程语言中,理解数据的内部表示对于有效地处理和操作数据至关重要。这份文档由K.V.R.S.Sarma (E&R)制作,旨在解释IBM主机上COBOL数据类型的内部表示方式,并涉及到二进制数据表示和二进制算术的基础知识。...
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 ...
"学习内部表示通过错误传播" 深度学习领域中,学习内部表示是指神经网络在处理任务时,自动学习和表示高维数据的能力。该领域的研究始于20世纪80年代,随着计算机视觉和自然语言处理技术的发展,学习内部表示变得...
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 ...
介绍: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. 压缩包里有以下文件: ...
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 ...
This Will Allow You To See A Visual Representation Of The Latency of Your Local Machines IP. A.k.a Lag Meter
Knowledge representation learning (KRL) aims to represent entities and relations in knowledge graph in low-dimensional semantic space, which have been widely used in massive knowledge-driven tasks....