Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
127 views
in Technique[技术] by (71.8m points)

java - What is IllegalStateException?

I am trying to use the following Fastload API

connection ... etc is perfect.


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
 ...........

Exception is

Exception in thread "main" java.lang.IllegalStateException: Sample failed.

[ODBC Teradata Driver] Invalid precision: cbColDef value out of range


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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...