0

I've been trying to learn Node.js recently, and I now want to access a database, which I use this library for. Problem is that I want to create a database on my computer and connect to it from my node.js program, but I can't for my life figure out how this is done!

In my solution I added a SQL Server Database Project, and tried to connect using this following string:

var connection = mysql.createConnection({
host     : 'localhost',
user     : 'me',
password : 'secret',
database : 'Database1'
});

But I'm getting an exception saying error connecting: Error: connect ECONNREFUSED 127.0.0.1:3306, which is thrown by some timeout (which I figure is because of the database isn't visible or something?). So my question is how do I set this up so I can work with data in Visual Studio, without having to rent a server to host my database? I'm not even sure I'm using the right project-template for my database, but I cannot see any other type of it. From what I've read on the Internet I see that there usually is some other template you should use to create a database.

I really don't know what to do, so any suggestions are welcomed.

Tokfrans
  • 1,939
  • 2
  • 24
  • 56

1 Answers1

0

It looks like to be an issue with the port.

This might help you out: Cannot connect to SQL Server with Node.js and Tedious

Community
  • 1
  • 1
Alex
  • 11
  • 2