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
This question is related to
java
illegalstateexception
Illegal State Exception is an Unchecked exception.
It indicate that method has been invoked at wrong time.
example:
Thread t = new Thread();
t.start();
//
//
t.start();
output:
Runtime Excpetion: IllegalThreadStateException
We cant start the Thread again, it will throw IllegalStateException.
package com.concepttimes.java;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class IllegalStateExceptionDemo {
public static void main(String[] args) {
// TODO Auto-generated method stub
List al = new ArrayList();
al.add("Sachin");
al.add("Rahul");
al.add("saurav");
Iterator itr = al.iterator();
while (itr.hasNext()) {
itr.remove();
}
}
}
IllegalStateException signals that method has been invoked at the wrong time. In this below example, we can see that. remove() method is called at the same time element is being used in while loop.
Please refer to below link for more details. http://www.elitmuszone.com/elitmus/illegalstateexception-in-java/
public class UserNotFoundException extends Exception {
public UserNotFoundException(String message) {
super(message)
Source: Stackoverflow.com