Skip to content
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

[BUG] Invalid Descriptor Index - SQL Server 2016 #416

Open
GernotKovar opened this issue Jan 17, 2025 · 0 comments
Open

[BUG] Invalid Descriptor Index - SQL Server 2016 #416

GernotKovar opened this issue Jan 17, 2025 · 0 comments

Comments

@GernotKovar
Copy link

Describe your system

  • odbc Package Version:
  • ODBC Driver: ODBC Driver 18 for SQL Server
  • Database Name: SQL Server
  • Database Version: 2016
  • Database OS: Windows 10 Pro
  • Node.js Version: 20.18.0
  • Node.js OS: Windows 10 Pro

Describe the bug
When the script executes the query 'SELECT * FROM Enterprise32.PrintingCenterUSA.AdditionalItemInfo WHERE JobNumber='950716' AND ItemNumber=1' gets executed I receive the error 'Invalid Descriptor Index' with package versions 2.4.8 and 2.4.9

When I select only one column, no error occurs. If I select all columns but specify each in the query it still triggers an error.

However when I use the version 2.4.7 the query works.

Expected behavior
No error should be triggered and the data should be returned as usual

To Reproduce

Create a table with the columns below and fill in the data below

Columns:

[{"name":"JobNumber","dataType":12,"columnSize":128,"decimalDigits":0,"nullable":false},{"name":"ItemNumber","dataType":4,"columnSize":10,"decimalDigits":0,"nullable":false},{"name":"Buyout","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":false},{"name":"BuyoutVendor","dataType":12,"columnSize":128,"decimalDigits":0,"nullable":true},{"name":"BuyoutPrice","dataType":3,"columnSize":19,"decimalDigits":4,"nullable":true},{"name":"ComponentNumbers","dataType":12,"columnSize":128,"decimalDigits":0,"nullable":true},{"name":"HasPO","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":false},{"name":"POSent","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":false},{"name":"POCreatedDate","dataType":93,"columnSize":27,"decimalDigits":7,"nullable":true},{"name":"POSentDate","dataType":93,"columnSize":27,"decimalDigits":7,"nullable":true},{"name":"IsDesignTool","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":false},{"name":"BuyoutVendorComments","dataType":12,"columnSize":0,"decimalDigits":0,"nullable":true},{"name":"PrintAsIs","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":false},{"name":"PrintAsIsNote","dataType":-1,"columnSize":2147483647,"decimalDigits":0,"nullable":true},{"name":"BuyoutVendorBridgeSuccess","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":true},{"name":"DesignID","dataType":12,"columnSize":255,"decimalDigits":0,"nullable":true},{"name":"MailingComponentNumber","dataType":4,"columnSize":10,"decimalDigits":0,"nullable":true},{"name":"PostageComponentNumber","dataType":4,"columnSize":10,"decimalDigits":0,"nullable":true},{"name":"WebsiteOrderItemID","dataType":4,"columnSize":10,"decimalDigits":0,"nullable":true},{"name":"DustJacketComponentNumber","dataType":4,"columnSize":10,"decimalDigits":0,"nullable":true},{"name":"IsRequestingCleanPDFGeneration","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":false},{"name":"DiscountPrice","dataType":3,"columnSize":19,"decimalDigits":4,"nullable":true},{"name":"WebsiteStatus","dataType":12,"columnSize":255,"decimalDigits":0,"nullable":true},{"name":"IsCustomSize","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":true},{"name":"WHF3291ProductName","dataType":12,"columnSize":50,"decimalDigits":0,"nullable":true},{"name":"MainComponentNumber","dataType":5,"columnSize":5,"decimalDigits":0,"nullable":true},{"name":"WHF3396ProductPage","dataType":12,"columnSize":50,"decimalDigits":0,"nullable":true},{"name":"ForeignPostageComponentNumber","dataType":4,"columnSize":10,"decimalDigits":0,"nullable":true},{"name":"IsHardProof","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":true},{"name":"HardCopyHasPO","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":true},{"name":"HardCopyPosent","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":true},{"name":"HardCopyPosentDate","dataType":93,"columnSize":23,"decimalDigits":3,"nullable":true},{"name":"BuyoutStatus","dataType":12,"columnSize":255,"decimalDigits":0,"nullable":true},{"name":"Binding","dataType":12,"columnSize":255,"decimalDigits":0,"nullable":true},{"name":"EPM","dataType":4,"columnSize":10,"decimalDigits":0,"nullable":true},{"name":"Thumbnail","dataType":12,"columnSize":0,"decimalDigits":0,"nullable":true},{"name":"ShrinkWrap","dataType":12,"columnSize":50,"decimalDigits":0,"nullable":true},{"name":"IsODT","dataType":-7,"columnSize":1,"decimalDigits":0,"nullable":true}]

Data:

[{"JobNumber":"950716","ItemNumber":1,"Buyout":"0","BuyoutVendor":"","BuyoutPrice":0,"ComponentNumbers":"1","HasPO":"0","POSent":"0","POCreatedDate":null,"POSentDate":null,"IsDesignTool":"0","BuyoutVendorComments":null,"PrintAsIs":"0","PrintAsIsNote":"","BuyoutVendorBridgeSuccess":null,"DesignID":"","MailingComponentNumber":0,"PostageComponentNumber":0,"WebsiteOrderItemID":902783,"DustJacketComponentNumber":0,"IsRequestingCleanPDFGeneration":"0","DiscountPrice":0,"WebsiteStatus":"","IsCustomSize":"0","WHF3291ProductName":"Booklet","MainComponentNumber":1,"WHF3396ProductPage":"Booklet","ForeignPostageComponentNumber":0,"IsHardProof":null,"HardCopyHasPO":null,"HardCopyPosent":null,"HardCopyPosentDate":null,"BuyoutStatus":null,"Binding":"Saddle Stitch","EPM":null,"Thumbnail":null,"ShrinkWrap":null,"IsODT":null}]

Code

SQL.LOG

const odbc = require('odbc');

async function runQuery() {
try {
const connection = await odbc.connect({
connectionString: 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=BHARATEPMSTEST;DATABASE=Enterprise32;UID=sa;PWD=1z4fLB5Q68;',
connectionTimeout: 10,
loginTimeout: 10,
});
const result = await connection.query("SELECT * FROM Enterprise32.PrintingCenterUSA.AdditionalItemInfo WHERE JobNumber='950716' AND ItemNumber=1");
console.log(JSON.stringify(result.columns));
await connection.close();
} catch (err) {
console.error('ODBC Error:', JSON.stringify(err));
}
}

runQuery();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant