tedious icon indicating copy to clipboard operation
tedious copied to clipboard

Nothing happens when trying to connect to Database

Open malarcherc opened this issue 4 years ago • 9 comments

Literally copied and pasted the first example of connecting to the database and put in my crededntials but the program does not provide any output either on console logging a success and no error output either. No idea how to fix or even approach this .

malarcherc avatar Feb 07 '21 17:02 malarcherc

Hi @malarcherc, can you provide the script you attempted to run? It might be because the server IP is not found in the config, in which case you can try using "server": "localhost" instead.

IanChokS avatar Feb 08 '21 16:02 IanChokS

The other problem I could think of is that you're missing to call .connect() on the created Connection object? This has recently changed in the API, so whatever example you might be using might be outdated?

arthurschreiber avatar Feb 08 '21 17:02 arthurschreiber

The other problem I could think of is that you're missing to call .connect() on the created Connection object? This has recently changed in the API, so whatever example you might be using might be outdated?

Thank you so much, this was driving me insane. No examples or documentation I've read accounts for this, not even the linked documentation.

jokarl avatar Feb 17 '21 09:02 jokarl

The other problem I could think of is that you're missing to call .connect() on the created Connection object? This has recently changed in the API, so whatever example you might be using might be outdated?

Thank you so much, this was driving me insane. No examples or documentation I've read accounts for this, not even the linked documentation.

Strongly echoing this feedback - the getting started doc misses the newly-required call to .connect and it's tough to spot the difference in the supplied examples if you're already looking at an outdated post from somebody's blog. It's tough to spot because there is no indication or output that something is wrong - the code just simply does nothing.

dkisselev avatar Feb 20 '21 00:02 dkisselev

Can somebody post a code snippet of where the .connect() goes?

sdtacoma avatar Mar 16 '21 17:03 sdtacoma

Can somebody post a code snippet of where the .connect() goes?

On the connection, new Connection(config).connect(). I ended up switching to node-mssql which was a lot cleaner to use. Might be worth checking if that is an option for you.

jokarl avatar Mar 16 '21 17:03 jokarl

Or as per the minimal example, it can go on its own line after you've configured all the connection parameters: https://github.com/tediousjs/tedious/blob/master/examples/minimal.js#L29

dkisselev avatar Mar 16 '21 17:03 dkisselev

@jokarl node-mssql uses an old outdated version of tedious so I recommend using the latest tedious (11.0.6) if you can. I apologize for the documentation not communicating the new API change, but I'll update that today! @dkisselev Thanks for pointing out that the changes are visible on the examples page for now!

IanChokS avatar Mar 16 '21 17:03 IanChokS

The documentation has been updated! I hope this clarifies the API a bit better. Sorry for the confusion earlier!

IanChokS avatar Mar 16 '21 18:03 IanChokS