Tedious: Nothing happens when trying to connect to Database

Created on 7 Feb 2021  路  9Comments  路  Source: tediousjs/tedious

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 .

Most helpful comment

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

All 9 comments

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.

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?

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.

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.

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

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.

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

@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!

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

Was this page helpful?
0 / 5 - 0 ratings