Host Engineering Forum

General Category => Do-more CPUs and Do-more Designer Software => Topic started by: ATU on October 10, 2013, 01:11:34 PM

Title: Access Database
Post by: ATU on October 10, 2013, 01:11:34 PM
Pleading ignorance on the subject, would it be possible to use the DoMore and write a program to query an Access Database over the network?  If so how involved do you think it would be?
Title: Re: Access Database
Post by: b_carlton on October 10, 2013, 02:35:25 PM
Contact BizwareDirect - http://www.bizwaredirect.com/
Their 'Dataworx Professional' may be what you want.
Title: Re: Access Database
Post by: ATU on October 10, 2013, 02:48:14 PM
The customer is already using that package, I was trying to see if it was possible to get rid of the PC.
Title: Re: Access Database
Post by: b_carlton on October 10, 2013, 03:13:30 PM
Are you trying to eliminate the Dataworx program? If so then some program somewhere has to receive the UDP based communications from the PLC, query the database, and return the information. That program would probably have to be running on a PC. If you intend to retain the Dataworx program (which does all of the above) then it also has to be running on something. The database itself also has to be somewhere, though possibly on a more centralized server.
Title: Re: Access Database
Post by: ATU on October 10, 2013, 03:21:32 PM
The database is on a centralized server, not this PC. Its running the DataWorx which receives the commands from an 06. I was just wondering if it was possible with all the tools available in the DoMore, to be able to access the database directly?
Title: Re: Access Database
Post by: plcnut on October 10, 2013, 03:34:52 PM
Are you pulling in the entire database?
Is it just a .csv file?
Title: Re: Access Database
Post by: ATU on October 10, 2013, 03:54:11 PM
No, I want to do a query for a specific record and retrieve all the data for that particular index.
Title: Re: Access Database
Post by: plcnut on October 10, 2013, 05:43:07 PM
It will take some work to make it happen. The DoMore can send the Server the query, but something on the Server will have to execute the query. Php or .NET working with SQL could do it, but you will have to write all the scripts to make it happen.
Title: Re: Access Database
Post by: ATU on October 10, 2013, 07:24:18 PM
So its just a file sitting on a server, not a Database server like SQL or MySql.  The file would need to be parsed. Thanks, told you I plead ignorance. ???
Title: Re: Access Database
Post by: plcnut on October 11, 2013, 07:21:46 AM
Quote
So its just a file sitting on a server, not a Database server like SQL or MySql.

That is the part we don't know.
You would have to find out from IT just what is there.
If the capability to run php and MySql is there, then basically what you do is build a php web page (called sqlquery.php for example) that can execute a MySql query.
Here is a sample php page from our system:

Quote
        <?php
          global $row;
            include_once('resources/init.php');
            $query1 = \mysql_query("SELECT `Index`, `SKU`, `LOC`, `QUAN`,`InStock` FROM $_GET[action]");
            while ($row = mysql_fetch_assoc($query1)){
                echo    $row['loc'].",". $row['quan'].",";
            }
        ?>

Then in the DoMore you can:
OPENTCP: referencing the Server.
STREAMOUT: "GET http://(your server ip)/sqlquery.php?action=row1 $0D$0A"
(in this example, by changing the "action=" variable, you can tell it which database to pull from)
STREAMIN: referencing the server

This STREAMIN will contain a Comma Separated string listing all of the "loc" and "quan" columns in the database.

It really comes down to what kind of IT department you are working with, and whether your working with an ever changing system that will need the scripts to be tweaked all the time. If the system is static, and you can get a reliable script on the Server, then I think it is a great way to go.
Title: Re: Access Database
Post by: ATU on October 11, 2013, 01:51:44 PM
Thanks, I've asked the question.  I could do PHP and MySql, but I doubt that I'm that lucky.
Title: Re: Access Database
Post by: deep6ixed on October 14, 2013, 03:02:53 AM
If this helps, there is a PHP modbus module on google code...

http://code.google.com/p/phpmodbus/

If needed the Php server could handle most of the work.
Title: Re: Access Database
Post by: CReese on October 14, 2013, 06:28:08 PM
pymodbus is great and easy to use. python has libraries for any database you want, so it makes excellent glue.