Connect and use an SQL db

Hi everyone, so i'm new to SQL databases, but i'm trying to learn. I've an db implemented but i can't connect with it, i'm using the "node-red-contrib-sql" and when i configure the server it should (for what i believe) automatically retrieve all tables availables (i've some), but it doesn't retrieve anything (the db works fine). Can someone helpme? What info do you need?

1 Like

step 1: can you connect to the database and add retrieve data without using node-red?

step 2: what do the node-red logs say?

i can connect to the database and retrieve data without node-red.

it appears a red triangle over the node (the one that means that something is not configured), if i ignore that and inject something on the node this is thrown: "Error: Pool was destroyed"

Andres,
I had some initial errors as well. The information does not tell you that if you connect using SQL permission you need to blank the domain. You cannot use both domain and SQL sign on. If you sign on as Windows permission, you may need the password as part of your login however. Hope this helps.

Sorry, i didn't understand your answer. In the part where you can edit the info of the server you have the following fields (and what do i believe what i have to put):

  • Name: this field doesn't matter to the server
  • Dialect: for a sql database i believe that i have to select the PostgreSql
  • Host | Port: ip of the sql server | port of the sql server
  • Database: name of the database
  • Username: username of the sql server
  • Password: password of the sql server
  • Minimum number of connections: i have no idea what this is for (i just put 0)
  • Maximum number of connections: also i have no idea what this is for (i just put 2)
  • Use SSL: i believe that this is for secure conections

Note, the SQL server and the node-red are not working on the same pc.

I don't believe you have told us which database you are using. It would be much easier to help if you posted a flow and details of your database.
Garry

i'm using a microsoft sql database, the administrator of it told me that is none of those dialects (refearing to the 3 that the config. node provides). About the flow, i don't have one, since i can't connect to the db.

maybe you need a node more suited to MSSQL?... there are several on flows.nodered.org

https://flows.nodered.org/?term=mssql&num_pages=1

Ok, i'll try that option, i will post any update. Thanks!

I am currently using node-red-contrib-mssql for my microsoft sql database transactions. If you are not committed to using node-red-contrib-sql, then give the node above a try.

This is a very easy setup
image

Thanks,
Mike

1 Like

Andres,
I was under the impression you were using the "MSSQL" node vs the default "sqldbs". Perhaps I missed which node you were using.

You need to install it from your "Manage Palette" and "Install" tab. Install "node-red-contrib-mssql-plus".

The MSSQL will attach to any Microsoft SQL database. I connect to 2008R2 and SQL Server 2000 servers on our domain. Again, if you log into the SQL with SQL Server permission, you do not use the domain. That was my point. I hope that clears up the mud.

@dceejay that was what i needed.

I'm currently using MSSQL-PLUS.

@arneym Thanks for that screenshot, it was what i needed for configuring the node in the right way!

Thanks to all for your answers!

2 Likes