问题描述
我正在尝试使用
连接...等完美。
I确切地知道它失败的地方
I know exactly where it fails
...........
System.out.println(" Streaming " + dataFile);
pstmtFld.setAsciiStream(1, dataStream, -1); // This line fails
System.out.println("check the above line"); // This does not go to console
...........
异常是
线程main中的异常java.lang.IllegalStateException:示例失败。
[ODBC Teradata Driver]无效精度:cbColDef值超出范围
这是我要上传的表格。它是 .csv
格式,当我通过记事本打开它时,它看起来像这样
Here is my table that I am trying to upload. It is a .csv
format and when I open it via notepad it look like this
1,9,Win
2,9,Winc
3,9,Wi
为什么我会得到这个例外?我怎样才能改进它?据我所知,问题是 pstmtFld.setAsciiStream(1,dataStream,-1);
不会以某种方式接受数据集并抛出异常
Why do I get this exception? How can I improve it? As far as I understand the problem is pstmtFld.setAsciiStream(1, dataStream, -1);
does not accept the dataset somehow and throw an exception
推荐答案
通常,用于表示在非法或不适当的时间调用了某个方法。但是,这看起来并不是它的特别典型用法。
Usually, IllegalStateException
is used to indicate that "a method has been invoked at an illegal or inappropriate time." However, this doesn't look like a particularly typical use of it.
您链接的代码表明它可以在该代码中抛出 / em>在第259行 - 但仅在将 SQLException
转储到标准输出之后。
The code you've linked to shows that it can be thrown within that code at line 259 - but only after dumping a SQLException
to standard output.
我们无法分辨从那个异常中出了什么问题 - 更好的代码会使用原始的 SQLException
作为原因异常(或者只是让原始异常在堆栈中传播) - 但是你应该能够看到标准输出的更多细节。查看该信息,您应该能够看到导致异常的原因并进行修复。
We can't tell what's wrong just from that exception - and better code would have used the original SQLException
as a "cause" exception (or just let the original exception propagate up the stack) - but you should be able to see more details on standard output. Look at that information, and you should be able to see what caused the exception, and fix it.
这篇关于什么是IllegalStateException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!