Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Oracle "Invalid Column Type"

When trying to do a simple tOracleInput -> tMap -> tOracleOutput flow, I'm getting the following error:
Exception in component tOracleOutput_1
java.sql.SQLException: Invalid column type

I've made sure that the source schema definition is exactly the same as the target schema definition (by pressing "Sync Columns"), but the error continues.
I'm wondering if the JAVA - Object --> Oracle Varchar2 mapping is causing the problem. Anyone experience the same thing?
Labels (3)
14 Replies
Anonymous
Not applicable
Author

I got the similar error, the only difference in my case is that I use tOracleSP, so the database function returns CLOB data. I went trought talend mapping file, where the specification says db CLOB to java OBJECT.
Hm, so I took a look into the source and discovered somthing strange. java.sql.Types.OTHER object is used in Talend to work with CLOB and I expect the same behavior for BLOB data types. So I did a test project directly in Eclipse test which implementation works:
_________________________________________________________________
First there is some connection needed>
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//
// or you could use a following way:
// DriverManager.registerDriver
// (new oracle.jdbc.driver.OracleDriver());
String url = "jdbc 0683p000009MA5A.pngracle:thin:@//172.28.140.110:1521/XE";
Connection conn;
conn = DriverManager.getConnection(url, "fnkvip", "oracle");
if (conn != null) {
System.out.println(" connection good");
} else {
System.out.println(" connection failed");
}
conn.setAutoCommit(false);
___________________________________________________
Ok, next I will specify what I want to call and how
// This is calling my oracle packaged function
OracleCallableStatement ocs = (OracleCallableStatement) conn
//? = call PACKAGE_NAME.FUNCTION_NAME(parameter1,parameter2,...parameterN)
// the first ? char is used in case you call a database function, which has always a return value of type Integer
.prepareCall("{? = call ROZHRANI_S_POJ.VRAT_XML_FDAVKU(?,?,?,?,?,?,?,?,?,?)}");
// Set up parameters, each char '?' in prepareCall has its index number, based on this
// , I will work with these as input or output parameters
// Set up input parameters
ocs.setString(2, "5D335BE1F6FB955683BF7125C5618E9B");
ocs.setString(3, "FN KRÁLOVSKÉ VINOHRADY ZEMAN Marek, MUDr.");
ocs.setString(4, "Fakultní nemocnice");
ocs.setString(5, "ZPMV ?R Pobo?ka PRAHA a ST?EDNÍ ?ECHY");
ocs.setString(6, "U Výstavi?t? 287 / 17");
ocs.setString(7, "Praha 7 - Hole?ovice");
ocs.setString(8, "170 00");

// Output parameters
// Each function on Oracle database has its return value, and this is it
ocs.registerOutParameter(1, java.sql.Types.INTEGER);
// Return of entity primary key
ocs.registerOutParameter(9, java.sql.Types.INTEGER);
// and here finally come 2 CLOBS parameters out
// !!!!!!!! And here come CLOB in place and is the possible root cause Talend implementation, they use java.sql.Types.OTHER type to get or set
// CLOB type. When I used it in this little java project, it returned the same error as talend> "Invalid column type". But when I changed it to
// java.sql.Types.CLOB, everything worked well as bellow>
ocs.registerOutParameter(10, java.sql.Types.CLOB);
ocs.registerOutParameter(11, java.sql.Types.CLOB);
// Execute the statement
ocs.execute();

// For testing I use only the last returned parameter
Clob clobXMLFDAVKA = ocs.getCLOB(11);

// And now I want to write returned CLOB data for example into a file using stream
BufferedWriter outFile = new BufferedWriter(new FileWriter("E://FDAVKA.out"));
java.io.BufferedReader in = new java.io.BufferedReader(clobXMLFDAVKA.getCharacterStream());
char[] buffer = new char;
int bytes_read;
StringBuffer stringBuffer = new StringBuffer();
while ((bytes_read = in.read(buffer)) != -1) {
stringBuffer.append(new String(buffer, 0, bytes_read));
}
outFile.write("" + stringBuffer);
outFile.close();

// But there is also simple way supported by the driver to get directly whole string from CLOB as bellow
String myString = clobXMLFDAVKA.getSubString(1, (int) clobXMLFDAVKA.length());

The in both stringBuffer and myString variables is the same content
I already reported this behavior to Talend bugtracker at> http://talendforge.org/bugs/view.php?id=16994
Best regards,
archenroot
Anonymous
Not applicable
Author

Hi,
Can you tell us what all the types of delimiters used in filed separator and Row Separator, for data migration purpose
Scenario: View to Flat file formats(CSV,xcel)
Regards,
Sukesh
Anonymous
Not applicable
Author

Hi every body
I have a project in Talend and I cannot understand this error :
"java.sql.SQLException: Invalid column type: sqlType=2003"
Any help please ! thank you
Anonymous
Not applicable
Author

Hello All,
I am getting same error. Did anyone got any resolution.

Exception in component tOracleOutput_2
java.sql.SQLException: Invalid column type: sqlType=2003
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedStatement.java:4405)
at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:4293)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setNull(OraclePreparedStatementWrapper.java:1280)
at local_project.ods_distributor_master_0_1.ODS_Distributor_Master.tOracleInput_2Process(ODS_Distributor_Master.java:16863)
at local_project.ods_distributor_master_0_1.ODS_Distributor_Master.runJobInTOS(ODS_Distributor_Master.java:35368)
at local_project.ods_distributor_master_0_1.ODS_Distributor_Master.main(ODS_Distributor_Master.java:35182)
Thanks,
Abhijit 
Anonymous
Not applicable
Author

Hi,

 

I solved it by setting the column to "byte[]" for Column Type and "RAW" for DB Type. Setting both schemas under tOracleOutput and tOracleInput:

 

0683p000009M7oh.png

 

Hope it helps!