• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » mssqlinput is trying to convert character data into numeric

#1 2011-12-21 23:51:14

billblack
Member
Registered: 2011-05-04
Posts: 17

mssqlinput is trying to convert character data into numeric

The MSSqlInput component is trying to convert character data into numeric data. My guess is because the getMetaData() function is returning an incorrect value for the column in question. The column is type nchar.

the generated code looks like this
...
                java.sql.ResultSetMetaData rsmd_tMSSqlInput_1 = rs_tMSSqlInput_1.getMetaData();
...
        if (talendToDBList_tMSSqlInput_1    .contains(rsmd_tMSSqlInput_1.getColumnTypeName(6).toUpperCase(java.util.Locale.ENGLISH)))
               {
            row4.SoldToPartyID = FormatterUtils.formatUnwithE(Double.valueOf(tmpContent_tMSSqlInput_1));
        } else {
            row4.SoldToPartyID = tmpContent_tMSSqlInput_1.trim();
        }
...

I get a java.lang.NullPointerException on the line
row4.SoldToPartyID = FormatterUtils.formatUnwithE(Double.valueOf(tmpContent_tMSSqlInput_1));
The db table rows have some character data in that column. I do not think it should be executing that line since the column is of character type.

The MSSQLInput component is executing a query that returns part of a table.

"select filename, BillingDate, PlanShipStartDate, ShipToParty, Shipment, 
SoldToPartyID, SoldToParty, Street, City, Region, PostalCode,
SalesDoc, Contact_name, Contact_phone, Hdr_cmnt, Delivery
from dbo.NT_Ord
where outorder_status is null
group by filename, BillingDate, PlanShipStartDate, ShipToParty, Shipment,
SoldToPartyID, SoldToParty, Street, City, Region, PostalCode,
SalesDoc, Contact_name, Contact_phone, Hdr_cmnt, Delivery
order by filename, BillingDate, PlanShipStartDate, Shipment, ShipToParty,
SoldToPartyID, SoldToParty, Street, City, Region, PostalCode,
SalesDoc"

The strange thing is it works OK on my development machine, but fails on the production machine. The database schema are identical. The production server is Windows server 2003 with SQLServer 2005. The dev machine is WIndows 7 with SQlServer 2008.

Any help is appreciated.

Offline

#2 2011-12-22 07:10:56

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: mssqlinput is trying to convert character data into numeric

Hi
It's a compatibility error with SQLServer.
Don't convert data in tMSSQLinput automatically. Use tMap to do this convertion.
Hope this will help you.

Best regards!
Pedro


Only Paranoid Survive.

Offline

#3 2011-12-22 14:16:11

billblack
Member
Registered: 2011-05-04
Posts: 17

Re: mssqlinput is trying to convert character data into numeric

pedro,
You misunderstand. This is happening in the generated code of the MSSqlInput component where it stores data in the output row. I can not change it. The error occurs where it is trying to convert character data into numeric data, I suspect because the getMetaData function is returning incorrect metadata. I am not a java expert so I dont know how to proceed to find the problem.

Offline

#4 2011-12-22 15:13:57

ytuzet
Member
Registered: 2009-12-10
Posts: 72

Re: mssqlinput is trying to convert character data into numeric

Hi,

try to change the type of that column in the metadata repository directly and force the one you want

Offline

#5 2011-12-22 17:48:50

billblack
Member
Registered: 2011-05-04
Posts: 17

Re: mssqlinput is trying to convert character data into numeric

Thanks for the suggestion.
The metadata is not in the repository because this is a query in the metadata repository. The metadata is built-in to the MSSQLInput component. I have manually set the metadata to the correct types.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » mssqlinput is trying to convert character data into numeric

Board footer

Powered by FluxBB