Writing from EPIC to SQL Server database

I am trying to write 3 tags (int, string, and float) from an EPIC PR1 controller to a SQL Server database and am having no luck.
These are triggered writes that happen when an integer tag goes true, and they only happen every hour or so, and just need to write one record. I have been trying to use OptoDataLink but to no avail. Can’t get the connection to happen. We know the server, database name, table, and login and password are all correct as we can login in to the database with them, but it won’t work with OptoDataLink.
We are using PAC Project 10.4.
We can ping the EPIC from the computer that the server resides on, so we know that there is network connectivity. My application (waste water pH control) on the EPIC is running great - we just can’t get the data to log to the database.

One of the errors we are getting is:
“Could not connect to database [ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB]SSL Security error
ERROR [01000][Microsoft][ODBC SQL Server Driver][DBNETLIB] ConnectionOpen(SECDoClientHandshake()).”

There are other PC’s on this subnet that are using OptoDataLink to write from PAC R1’s to a different database on the same SQL Server machine. We looked at how they are setup and tried that as well. No luck.

Is there an easier way to do this? Some have suggested Node Red, but you have to find a node that does this, and I have not used Node Red before, so it needs to be pretty straightforward.

thanks for any help!

  • Kurt

It will take me 2-3 weeks to set up and get up to speed on OptoDataLink again… or you can spin up Node-RED on the EPIC, install the MSSQL node, look at the example code in the Forums here and be up and running in 10-15 minutes.

Either way, the fact that other deices work, but this EPIC throws a ‘could not connect’ error makes it sound like a networking / DNS configuration issue so either way might be harder than it should be.

Can you ping the MSSQL computer from the EPIC? Im guessing not, but its worth a try from the network tools in groov Manage.

On the PC you are running OptoDataLink on, you may try installing newer SQL OLE DB drivers and see if you have better luck:

I recommend using Node-Red for this type of task for any future development though.

1 Like

Thanks Ben - I will look into the Node Red. Where is the MSSQL node? Is that one I have to load?

Thanks

Kurt

For installing the MSSQL node:

For using the Node:
https://forums.opto22.com/search?q=mssql

@torchard has a video on the subject here:

Thank you Ben! For a novice at Node Red, this looks kind of daunting

I will keep at it.

Kurt

Also, while I have extension experience programming in PAC Control and in ladder, I have no experience with java script, so I need a node for writing tags to SQL Server that does not involve me writing javascript code.

Best regards

Kurt

So we ended up getting OptoDataLink to work. It ended up being some network and ODBC driver issues that the client had to fix. I’ve asked them for a summary of what they did and I will post if here. We are successfully logging triggered data writes so SQL server from the EPIC.
Thanks for all the suggestions everyone. - Kurt

BTW, the SQL Server database resides on a Windows Server machine. Both are 2016 editions, however in OptoDataLink we had to select the the SQL 2000 version.

Given your comments about JavaScript, I am glad you got the network issues sorted and DataLink up and running.
Thanks for reporting back and letting us know what you found.