-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ODBC Error: Invalid character value for cast specification #327
Comments
You should get a message like |
Which logging level should I use? The error message I sent was the only line in the log file when I had the logging level set to Error.
Thanks,
Rick L.
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Bogdan Pintea ***@***.***>
Sent: Tuesday, November 19, 2024 10:57:12 AM
To: elastic/elasticsearch-sql-odbc ***@***.***>
Cc: Leasure, Rick ***@***.***>; Author ***@***.***>
Subject: Re: [elastic/elasticsearch-sql-odbc] ODBC Error: Invalid character value for cast specification (Issue #327)
Caution: External email. Do not open attachments or click on links if you do not recognize the sender.
Closed #327<https://urldefense.com/v3/__https://github.com/elastic/elasticsearch-sql-odbc/issues/327__;!!IqUcNYopQPk7!O20clEdM5-rfuBda2DbpMOLJ-vFzpJDkHOfzeaPK9FH7-SaMqDARIuzZSMe5OVXWtMeHUsLRF6ipJWWyQU2zy8jl9xPdZg$> as not planned.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/elastic/elasticsearch-sql-odbc/issues/327*event-15351772563__;Iw!!IqUcNYopQPk7!O20clEdM5-rfuBda2DbpMOLJ-vFzpJDkHOfzeaPK9FH7-SaMqDARIuzZSMe5OVXWtMeHUsLRF6ipJWWyQU2zy8i51V3YIg$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/BNCAB2C2KIUUCBVOTF34RTD2BNNVRAVCNFSM6AAAAABSCHMK2GVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJVGM2TCNZXGI2TMMY__;!!IqUcNYopQPk7!O20clEdM5-rfuBda2DbpMOLJ-vFzpJDkHOfzeaPK9FH7-SaMqDARIuzZSMe5OVXWtMeHUsLRF6ipJWWyQU2zy8hfDMs7PQ$>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or intended recipient’s authorized agent, the reader is hereby
notified that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
|
Debug |
In the attached log I found the error message, Wed Nov 20 07:20:57 2024 - [ERROR] sql2c_string()@convert.c:3489 [STMT@0x00000230C2E6C6F0] can't convert A little more background, I am not pulling all the columns available in the table. I am assuming that the column # is assigned to the third column I selected and not the actual third column in the table. Is this correct? I have checked the actual third column in the table, which is a REAL/float data type, but it does not contain any character string data that I can see. Am I reading this log correctly? Thanks, |
The logs contain the following relevant entries:
The first line logs the parameters received from the application, with no manipulation (i.e. before copying anything in internal structures). The key element there is The |
I am using Microsoft SQL Server SSIS (also known as Microsoft SQL Server Data Tools) 2019 to pull the data from ElasticSearch. Looking at the ODBC Source task, the third result set column (called Output Column in SSIS) is set to data type text stream [DT_TEXT]:
***@***.***
However, when I look at the External Columns, the third column is amountExpected, which is data type float [DT_R4]:
***@***.***
I am not trying to pull amountExpected. Is it possible that the ODBC driver is actually looking at the External Columns, which are all the columns available in the index, instead of just the columns I selected which are represented by the Output Columns?
Let me know if you need any more information.
Thanks,
Rick L.
From: Bogdan Pintea ***@***.***>
Sent: Thursday, December 12, 2024 12:29 PM
To: elastic/elasticsearch-sql-odbc ***@***.***>
Cc: Leasure, Rick ***@***.***>; Author ***@***.***>
Subject: Re: [elastic/elasticsearch-sql-odbc] ODBC Error: Invalid character value for cast specification (Issue #327)
Caution: External email. Do not open attachments or click on links if you do not recognize the sender.
The logs contain the following relevant entries:
Wed Nov 20 07:20:57 2024 - [DEBUG] ***@***.***:947 ENTER: ***@***.***, ColumnNumber=3, TargetType=7, ***@***.***, BufferLength=51, ***@***.***
...
Wed Nov 20 07:20:57 2024 - [DEBUG] ***@***.***:581 ***@***.*** AxD data C type: 7.
Wed Nov 20 07:20:57 2024 - [DEBUG] ***@***.***:3486 ***@***.*** string `Soham Sarkar` converted to dbl=0.000000e+00.
Wed Nov 20 07:20:57 2024 - [ERROR] ***@***.***:3489 ***@***.*** can't convert `Soham Sarkar` to double.
The first line logs the parameters received from the application, with no manipulation (i.e. before copying anything in internal structures). The key element there is TargetType=7, which means the application wants to have the result provided as an SQL real type (SQL_C_FLOAT<https://urldefense.com/v3/__https:/github.com/microsoft/ODBC-Specification/blob/4dda95986bda5d3b55d7749315d3e5a0951c1e50/Windows/inc/sqlext.h*L553C9-L553C20__;Iw!!IqUcNYopQPk7!MrdqNX7hR5aTqmHxGPUaNIsbWPlE8ONTSKjZDlE2bxZO1BAgXm2jAujHPvgrXfH3mVGzCCPu9vh0_lD99Le3ca7mCT__aA$>, which is same as SQL_REAL<https://urldefense.com/v3/__https:/github.com/microsoft/ODBC-Specification/blob/4dda95986bda5d3b55d7749315d3e5a0951c1e50/Windows/inc/sql.h*L206__;Iw!!IqUcNYopQPk7!MrdqNX7hR5aTqmHxGPUaNIsbWPlE8ONTSKjZDlE2bxZO1BAgXm2jAujHPvgrXfH3mVGzCCPu9vh0_lD99Le3ca6ScOqw1g$>).
The ColumnNumber=3 means the 3rd column in the result set (not the source table), 1-based. (The function's documented here<https://urldefense.com/v3/__https:/learn.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function__;!!IqUcNYopQPk7!MrdqNX7hR5aTqmHxGPUaNIsbWPlE8ONTSKjZDlE2bxZO1BAgXm2jAujHPvgrXfH3mVGzCCPu9vh0_lD99Le3ca7_GaT4ag$>.)
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/elastic/elasticsearch-sql-odbc/issues/327*issuecomment-2539575390__;Iw!!IqUcNYopQPk7!MrdqNX7hR5aTqmHxGPUaNIsbWPlE8ONTSKjZDlE2bxZO1BAgXm2jAujHPvgrXfH3mVGzCCPu9vh0_lD99Le3ca7ZDFrmRQ$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/BNCAB2BTTAARQ7R2MAAWC2D2FHBVJAVCNFSM6AAAAABSCHMK2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZZGU3TKMZZGA__;!!IqUcNYopQPk7!MrdqNX7hR5aTqmHxGPUaNIsbWPlE8ONTSKjZDlE2bxZO1BAgXm2jAujHPvgrXfH3mVGzCCPu9vh0_lD99Le3ca6IiHty9A$>.
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or intended recipient’s authorized agent, the reader is hereby
notified that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
|
@RickL18393, your email didn't make it through as you might have sent it. Have a look over the web, please. |
I am using Microsoft SQL Server SSIS (also known as Microsoft SQL Server Data Tools) 2019 to pull the data from ElasticSearch. Looking at the ODBC Source task, the third result set column (called Output Column in SSIS) is set to data type text stream [DT_TEXT]: However, when I look at the External Columns, the third column is amountExpected, which is data type float [DT_R4]: I am not trying to pull amountExpected. Is it possible that the ODBC driver is actually looking at the External Columns, which are all the columns available in the index, instead of just the columns I selected which are represented by the Output Columns? I also checked the amountExpected column using DBVis and the string that is causing the error is not in any of the rows for that column. Let me know if you need any more information. Thanks, |
Is that autodetected, or does the user set that?
No, the driver doesn't have access to any of that, it's just a proxy between the ODBC API / application and Elasticsearch'es SQL REST API and doesn't hold state more than connection and results-related. The query is contained in the log (truncated excerpt):
and so are the columns of the response (0-based indexing):
But as written above, SSIS requests for some reason the output to be converted to a floating point number (1-based):
Indeed, the string that can't be converted to a number is sourced from the Does it work loading this data in other apps (like Excel or some other SQL editor, like DbVisualizer)? |
Is that autodetected, or does the user set that? That column is autodetected as Unicode text stream [DT_NTEXT]. We do not need Unicode, so I changed it to text stream [DT_TEXT] But as written above, SSIS requests for some reason the output to be converted to a floating point number (1-based): I would suggest that this is the bug we are chasing, whether it be in the ODBC driver or SSIS. Indeed, the string that can't be converted to a number is sourced from the analyst field/column. Thank you for the clarification. That column does contain the string in question. Does it work loading this data in other apps (like Excel or some other SQL editor, like DbVisualizer)? I have not tried to pull the data with any other applications. My DbVis connection is using the JDBC driver, so I don't think that What happens in SSIS if you limit the loaded fields/columns to only string ones, like just the first and third? I created a new Data Flow task and only selected the addnl and anaylst columns. I am now getting a different set of error [ODBC Source [2]] Error: SQLSTATE: HY000, Message: [Elastic][EsODBC 8.15.1(v8.15.0-1-g43209d3,u,r) Driver]Invalid server answer; [ODBC Source [2]] Error: SQLSTATE: HY000, Message: [Elastic][EsODBC 8.15.1(v8.15.0-1-g43209d3,u,r) Driver]Invalid server answer; [ODBC Source [2]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "ODBC Source.Outputs[ODBC [SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on ODBC Source returned error You could also try to set the Varchar limit to a non-0 value and observe if SSIS handles the field differently. Varchar Limit is already set to 8000. |
Is DT_WSTR/DT_STR making any difference? (Not very familiar with SSIS though.)
Could be a bug, could also be a misconfiguration.
Could you share the log files of the driver in this case too? |
I have deleted and recreated my SSIS package. I am no longer trying to change data types in the ODBC Source task, so all columns from the Elasticsearch index are being pulled as the data type that was auto detected. I am still getting this error: [ODBC Source [14]] Error: SQLSTATE: 22018, Message: [Elastic][EsODBC 8.15.1(v8.15.0-1-g43209d3,u,r) Driver]Invalid character value for cast specification; Running the SSIS package created 6 log files, the majority of which are over 353MB. I put them in a .zip file which got them down to 40MB, but this website will not upload the file. I assume it is too large. I have attached the smallest file. Hopefully that will give you the information you need. If it doesn't, than let me know where I can upload the .zip file. Thanks, esodbc_20241218105733_8c37f8d3110e45509651c681c5b9d344.ece.optum.com_9243_8732-1.log |
FYI, I will be on vacation starting 12/20/2024 returning to the office on 1/6/2025. Rick L. |
Unfortunately the log contains the same failure as before, so there's nothing new. Regarding the above message, I'd be interesting to know the answer for the 1st one and if there are logs for the 3rd point there. The reasons being:
If the logs will be too large achieved in this case too, I will provide you with a resource where to upload them. |
The autodetected data type for the analyst column is DT_NTEXT in my new SSIS package, so I don't think that makes a difference: I deleted the original SSIS package and logs that showed the Invalid server answer error, however I was able to recreate the SSIS package and got the same error. The logs are below: I am going to be busy on another project the rest of today and as I stated in my earlier comment I am on vacation starting tomorrow, 12/20/2024. I will be back on 01/06/2024. Thanks, |
Thanks. There's something quite off there. I can see in the logs the query with two columns:
but then the app asks for a 4th column:
The driver assumes a server error (as it's not parsing the query to understand how many columns to expect), but in this case it's an application error. Might need to look further to the logs and SSIS deployment options, but that might not happen timely and it seems very specific to this deployment in particular. |
I am back from vacation. Where do we stand on this issue?
Thanks,
Rick L.
From: Bogdan Pintea ***@***.***>
Sent: Friday, December 20, 2024 3:09 AM
To: elastic/elasticsearch-sql-odbc ***@***.***>
Cc: Leasure, Rick ***@***.***>; Mention ***@***.***>
Subject: Re: [elastic/elasticsearch-sql-odbc] ODBC Error: Invalid character value for cast specification (Issue #327)
Caution: External email. Do not open attachments or click on links if you do not recognize the sender.
I was able to recreate the SSIS package and got the same error.
Thanks. There's something quite off there. I can see in the logs the query with two columns:
Thu Dec 19 11:49:36 2024 - [DEBUG] ***@***.***:571 EXIT: ret=0, ***@***.***, *szSqlStr=[56] `select "addnlDetails" ,"analyst" from "settlement_stage"`, cchSqlStr=-3.
but then the app asks for a 4th column:
Thu Dec 19 11:49:36 2024 - [DEBUG] ***@***.***:947 ENTER: ***@***.***, ColumnNumber=4, TargetType=-8, ***@***.***, BufferLength=0, ***@***.***
The driver assumes a server error (as it's not parsing the query to understand how many columns to expect), but in this case it's an application error.
Might need to look further to the logs and SSIS deployment options, but that might not happen timely and it seems very specific to this deployment in particular.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https:/github.com/elastic/elasticsearch-sql-odbc/issues/327*issuecomment-2556486331__;Iw!!IqUcNYopQPk7!LkWmFrueQ201x-v73wefstraZGnMt80ITzNndPdI2ndQ4N7jZ1vkrd0IOfoz5IR0GP9L2tcK4_bg2LFJxXTU46Dvq4TbtQ$>, or unsubscribe<https://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/BNCAB2COY6AYCOIUDNK4LBL2GPGBPAVCNFSM6AAAAABSCHMK2GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNJWGQ4DMMZTGE__;!!IqUcNYopQPk7!LkWmFrueQ201x-v73wefstraZGnMt80ITzNndPdI2ndQ4N7jZ1vkrd0IOfoz5IR0GP9L2tcK4_bg2LFJxXTU46DbKYfDrQ$>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed. If the reader of this e-mail is not the intended
recipient or intended recipient’s authorized agent, the reader is hereby
notified that any dissemination, distribution or copying of this e-mail is
prohibited. If you have received this e-mail in error, please notify the
sender by replying to this message and delete this e-mail immediately.
|
I got an email that is the same as the comment you left right before I went on vacation. What do we need to do to move forward on getting this driver to work with SSIS? ElasticSearch online documentation states that the ElasticSearch ODBC driver is compatible with SSIS. I need a resolution to this issue ASAP, it is holding up a critical project. Thanks, |
As written above, in your installation there's something seriously misaligned. From the logs I see you're using the 64bit version of the driver -- is SSIS on same architecture? Also, during the exercise of configuring two columns only (as before), it might be useful to enable SSIS logging and check (or share) these logs for further clues as to why the interoperability fails. |
We are using the commercial version of ElasticSearch. Is there some place where I can get more timely replies? I can also tell you that I have quite a few SSIS packages that use ODBC drivers from other vendors that work just fine. That leads me to believe that the issue is with the ElasticSearch ODBC driver and not SSIS. If I am not mistaken, ODBC is a standard defined by Microsoft, so all ODBC drivers should look and act the same with SSIS. What is the latest version of SSIS that the driver has been tested against? {Added] I've been doing research on another issue related to ElasticSearch and I see that the ODBC driver may need to be licensed. Could this be causing these problems? Thanks, |
This is the development repository of the driver. If you have a commercial contact with Elastic, they might be able to assist you on the support steps.
I have found no evidence in the shared logs of any fault on the Elasticsearch ODBC driver part so far.
No, if the Elasticsearch cluster is running on the required license, the ODBC driver will connect, which wouldn't happen with an unfitting/expired license. However: I have just tried the latest driver release[*] on a SQL Server 2022 with Integration Services and successfully imported data from an Elasticsearch index over I would normally recommend starting small, maybe writing an Elasticsearch SQL query to only select a few columns (instead of importing a whole index), figure the required mappings and add progressively more columns/fields, although I do admit that the logs you've shared above do show something quite off, as written above. This might still be a misconfiguration, however. [*] The driver hasn't been updated since 8.15.1 that you're using. |
It appears that the issue is resolved. I took your advice about starting with one column and building up. The first thing I did, however, was to created an entirely new Visual Studio solution for this project. Last time I only created a new project within the solution I was already using. Anyway, the new solution appears to have resolved the issue and I am able to pull back all data from the index I've been working with. Thank you for your patience working through this with me! Rick L. |
I am using ODBC driver version 8.15.1-windows-x86_64 connecting to an ElasticSearch server running version 8.15.1. When I attempt to query data from an ElasticSearch table I am getting this ODBC error: [Elastic][EsODBC 8.15.1(v8.15.0-1-g43209d3,u,r) Driver]Invalid character value for cast specification;
When I turn on ODBC error logging I get this message: Mon Nov 18 12:12:53 2024 - [ERROR] sql2c_string()@convert.c:3489 [STMT@0x0000017FEFACF0B0] can't convert
Soham Sarkar
to double.Is there a way to determine which column the bad data is in from the ODBC error message?
Let me know if you need any more information.
Thanks,
Rick L.
The text was updated successfully, but these errors were encountered: