Configuration to get data from database

Hi
I’m so confusing :frowning:
Do I need to configurate two file to link to my database??

No, you can configure the MySQL database as your primary archive using the Outputs > Historian Instances page in the openPDC Manager, or you can set it up as a secondary archive using the Outputs > Manage Custom Outputs page. Either way, you need to create the TimeSeriesMeasurement table, but you only need to enter the configuration for one of either the primary archive or the secondary archive.

Also, you shouldn’t need to create any files in order to do this work. Just use your MySQL tools to create the database and then use the openPDC Manager for the rest.

Hi Stephen,

I’ve got this setup in my system:

1.- Credentials in my database are:
server: localhost
name: MyDatas
user: root
pass: sincrofasor#1

2.- Inside I’ve made this table:

 CREATE TABLE TimeSeriesMeasurement
(
    SignalID NCHAR(36) NOT NULL,
    Timestamp VARCHAR(24) NOT  NULL,
    Value DOUBLE NOT NULL
)

I’ll use next secondary archive :

Name : DATOS_OPENPDC
Type : ADO
BulkInsertLimit=500; DataProviderString={ AssemblyName={MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d}; ConnectionType=MySql.Data.MySqlClient.MySqlConnection; AdapterType=MySql.Data.MySqlClient.MySqlDataAdapter }; DbConnectionString={ Server= localhost ; Database= MyDatas ; Uid= root ; Password= sincrofasor#1 }; TableName= TimeSeriesMeasurements ; IDFieldName= SignalID ; TimestampFieldName= Timestamp ; ValueFieldName= Value ; InputSourceIDs= PPA04

When I made a query to my database I don’t get nothing.

Which are my errors?

I see at least one error here:

BulkInsertLimit=500; DataProviderString={ AssemblyName={MySql.Data, Version=6.9.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d}; ConnectionType=MySql.Data.MySqlClient.MySqlConnection; AdapterType=MySql.Data.MySqlClient.MySqlDataAdapter }; DbConnectionString={ Server= localhost ; Database= MyDatas ; Uid= root ; Password= sincrofasor#1 }; TableName= TimeSeriesMeasurements ; IDFieldName= SignalID ; TimestampFieldName= Timestamp ; ValueFieldName= Value ; InputSourceIDs= PPA04

According to your post, you called the table TimeSeriesMeasurement, singular and not plural.

That said, there could be other errors in your configuration that I can’t see from what you posted. For instance, why did you change the InputSourceIDs to PPA04? Is that really the name of your primary historian instance? Also, are you really using MySQL Connector/NET version 6.9.5? It’s a pretty old one, and I’m not sure you can even download it anymore.

For troubleshooting, I recommend using the openPDC Console to interact with the openPDC service to see errors and double-check the runtime configuration of your adapter. Hint: try using the list /o ADO command to see if it has any input measurements.

Stephen;

When I initial ADOAdapter I’ve got this error by console:

[PPA04] Could not load file or assembly ‘MySql.Data, Version=8.0.17, Culture=neutral, PublicKeyToken=c5687fc88969c44d’ or one of its dependenties.

It’s saying that it couldn’t load the MySql.Data assembly (MySql.Data.dll) provided by the MySQL Connector/NET adapter. You may need to get the .NET & Mono build of MySQL Connector/NET which is labeled “Architecture Independent”, as the Windows version appears to be labeled x86/32-bit. It’s a no-install version so the assemblies won’t go into the global assembly cache. You’ll have to copy the assemblies into the openPDC folder.

Ok,

Well I’ve found MySql.Data.dll inside my MySql Connector and I’ve copy it inside openPDC folder, but I still have same error :frowning:

For MySQL Connector/NET, did you use the .NET & Mono build that is architecture independent, or the Windows installer that is 32-bit only?

Only Windows installer 32-bit

You still need the other one, even if you already have the 32-bit one installed.

I’ve donwload Mono from https://www.mono-project.com/download/stable/ and I’ve installed but it still doesn’t work

What could I do?

I’m talking about MySQL Connector/NET. You go to the download page, select .NET & Mono from the dropdown, and then download the zip file from there.

Here, I’ve done it myself and obtained the download link. Just use this link to download the correct version of MySQL Connector/NET that will work with 64-bit applications like the openPDC.
https://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-8.0.18-noinstall.zip

Stephen, I’ve downloaded it, I copied and I pasted all files inside openPDC folder but it still doesn’t work.

By the way, openPDC folder has another folders… Do I have to copy files in any that folders?

PD: inside openPDC folder I have next folders:
Statics
Logs
DatabaseScripts
ConfigurationCacheArchive

OpenPDC console:


OpenPDC Manager:

When I press initialize button from openPDC I’ve got that error in openPDC console.

If you downloaded the link I sent you, the version you should be using is 8.0.18, not 8.0.17. You’ll need to change your connection string accordingly.

Stephen

I’ve copied and pasted files from https://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-8.0.17-noinstall.zip inside openPDC folder and you remember I’ve installed Windows installer too.

So, now I’ve followed all your tips but I still not have success.

OpenPDC console send me same errors that you can watch in screenshot above.

One more thing, have you tried restarting the openPDC service after copying the assemblies for version 8.0.17 into the openPDC directory?

I’ve rebooted computer and now openPDC service has troubles

I’ve setup it again and now openPDC works fine :slight_smile:

I attach a screenshot of my new results

I dont know if it work yet, but I’ve got new results.
When I open database I watch that data doesn’t store there :frowning:

PD: There was a moment when openPDC send [CRITICAL], so I’ve disable connector for any problem.

The error message in your screenshot indicates either that the ADO output adapter is not able to send data to MySQL as fast as it is being received or that the output adapter is only queuing data and is not processing, perhaps due to an error during adapter initialization. Leaving the adapter on should not cause problems because it will be able to dump data from its queue before using up all your system memory, but you will continue to lose data until you can figure out a way to speed up the process.