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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Exception in component tMSSqlInput_1 java.sql.SQLException: Invalid column name

Has anyone encountered invalid column name errors using the MSSQL component recently? I'm running into this error in my job:

 

Exception in component tMSSqlInput_1
java.sql.SQLException: Invalid column name 'Balance'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)

Here's my current query:

 

"SELECT
SiteId,
Name,
Comments,
Contact,
ContactPhone,
InstallDate,
Address,
Email,
LogoPath,
TimeZone,
Logo,
Factor,
CustomerId,
Balance,
date_update
FROM
sites (nolock)"

I've tried using Talend Open Studio v7.1.1 and v7.2.1 and both are throwing the same error. From what I can tell, "Balance" or "date_update" are not reserved names in Java or MSSQL.

 

Labels (5)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Sorry, I meant a schema DDL dump. The column is clearly there, but it could be defined in your DDL in a weird way

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Can you show us your table schema?

Anonymous
Not applicable
Author

Thanks for the quick response! I've included details about the MSSQL database table and the Talend schema below:

 

0683p000009M8EI.pngDatabase Schema0683p000009M8EN.pngTalend Schema

Anonymous
Not applicable
Author

Sorry, I meant a schema DDL dump. The column is clearly there, but it could be defined in your DDL in a weird way

Anonymous
Not applicable
Author

Gotcha. DDL below but nothing about the date_update column seems unusual.

 

CREATE TABLE sites (

SiteId int IDENTITY(1,1) NOT NULL,

Name nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

Comments nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

Contact nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

ContactPhone nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

InstallDate datetime NULL,

Address nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

Email nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

LogoPath nvarchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

TimeZone int NULL,

Logo image NULL,

Factor int NULL,

CustomerId int NULL,

Balance int NULL,

date_update datetime NULL,

CONSTRAINT Sites_PK PRIMARY KEY (SiteId)

)

 

In the meantime, I've tried using a CTE and/or aliasing the date_update column to a different string but I'm still running into the same error.

Anonymous
Not applicable
Author

Does this still happen if you remove the (nolock) hint?

Anonymous
Not applicable
Author

The column was clearly there, in the production environment. I'm a little ashamed to admit I was connected to a lower environment when encountering this "error". Thanks for your help!
Anonymous
Not applicable
Author

Exception in component tDBInput_1 (Copy_Citi_POC)
java.sql.SQLException: Invalid column name 'ADDRESS'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)
at project_01.copy_citi_poc_0_1.Copy_Citi_POC.tFixedFlowInput_1Process(Copy_Citi_POC.java:966)
at project_01.copy_citi_poc_0_1.Copy_Citi_POC.runJobInTOS(Copy_Citi_POC.java:1904)
at project_01.copy_citi_poc_0_1.Copy_Citi_POC.main(Copy_Citi_POC.java:1754)

 

 

Hi, I'm having a similar issue, my DbInput query looks like this: ""SELECT STUFF((SELECT ', ' + column_name FROM information_schema.columns WHERE
table_name ="+((String)globalMap.get("DBTable"))+" and table_schema = 'SRC' order by ordinal_position FOR XML PATH('')),1,2,'') as col1""

 

I have two table names with the same schema in a fixed flow component which iterates over a global variable "DBTable" on tflowtoiterate. I can help you with my job if someone can confirm if they understood my problem.

 

Thanks, in advance.

Anonymous
Not applicable
Author

Exception in component tDBInput_1 (Copy_Citi_POC)
java.sql.SQLException: Invalid column name 'ADDRESS'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1427)
at project_01.copy_citi_poc_0_1.Copy_Citi_POC.tFixedFlowInput_1Process(Copy_Citi_POC.java:966)
at project_01.copy_citi_poc_0_1.Copy_Citi_POC.runJobInTOS(Copy_Citi_POC.java:1904)
at project_01.copy_citi_poc_0_1.Copy_Citi_POC.main(Copy_Citi_POC.java:1754)

 

 

Hi, I'm having a similar issue, my DbInput query looks like this: ""SELECT STUFF((SELECT ', ' + column_name FROM information_schema.columns WHERE
table_name ="+((String)globalMap.get("DBTable"))+" and table_schema = 'SRC' order by ordinal_position FOR XML PATH('')),1,2,'') as col1""

 

I have two table names with the same schema in a fixed flow component which iterates over a global variable "DBTable" on tflowtoiterate. I can help you with my job if someone can confirm if they understood my problem.

 

Thanks, in advance.