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

Connection fails when not using connection string #578

Closed
nfantone opened this issue Dec 6, 2017 · 7 comments
Closed

Connection fails when not using connection string #578

nfantone opened this issue Dec 6, 2017 · 7 comments

Comments

@nfantone
Copy link

nfantone commented Dec 6, 2017

I'm trying to connect to a SQL Server 2014 and I'm getting different behaviors when using the connection string vs. the full configuration object.

This works and connects normally:

const conn = new sql.ConnectionPool('mssql://sa:sa@localhost/db');
const pool = await conn.connect();

While this, fails with the error shown below:

const options = {  
  user: 'sa', password: 'sa', server: 'localhost',  database: 'db',
  pool: {
    max: 10
    min: 0
    idleTimeoutMillis: 30000
  }
};
const conn = new sql.ConnectionPool(options);
const pool = await conn.connect();
buffer.js:479
    throw new TypeError('"string" must be a string, Buffer, or ArrayBuffer');
    ^

TypeError: "string" must be a string, Buffer, or ArrayBuffer
    at Function.byteLength (buffer.js:479:11)
    at WritableTrackingBuffer.writeString (C:\my-project\node_modules\tedious\lib\tracking-buffer\writable-tracking-buffer.js:209:27)
    at Login7Payload.addVariableDataString (C:\my-project\node_modules\tedious\lib\login7-payload.js:239:25)
    at Login7Payload.createVariableData (C:\my-project\node_modules\tedious\lib\login7-payload.js:199:12)
// ...

Exact version shown on server:

Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64) 
    Jun 17 2016 19:14:09 
    Copyright (c) Microsoft Corporation
    Express Edition (64-bit) on Windows NT 6.3 <X64> (Build 14393: )

Running on node 8.9.3.

@nfantone nfantone changed the title Connection failed when not using connection string Connection fails when not using connection string Dec 6, 2017
@iba-jsykes
Copy link

Googled that last debug line :

tediousjs/tedious#431

@nfantone
Copy link
Author

@iba-jsykes Doesn't seem to be related, I believe?

@iba-jsykes
Copy link

Only if you're running an older node version apparently. I never use the connection string, always the config object, but i'm running node 8.x at this point.

@nfantone
Copy link
Author

nfantone commented Dec 31, 2017

@iba-jsykes I'm also using LTS node (updated original issue to reflect that). Is your config object any different than mine? Are you trying to connect against a MS SQL 2014?

@iba-jsykes
Copy link

I do have the port in my config, and a few more pool options, but taking them out makes no difference.
I have 2012, 2014 and sqlexpress in my current set of databases I'm hitting.

@willmorgan
Copy link
Collaborator

@nfantone @iba-jsykes Are you still experiencing this on the latest version? (v4.2.2)

@dhensby
Copy link
Collaborator

dhensby commented Mar 8, 2019

closing due to lack of response / stale

@dhensby dhensby closed this as completed Mar 8, 2019
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

4 participants