News:

  • June 28, 2026, 03:34:38 PM

Login with username, password and session length

Author Topic: Access Database  (Read 22659 times)

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Access Database
« 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?

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Access Database
« Reply #1 on: October 10, 2013, 02:35:25 PM »
Contact BizwareDirect - http://www.bizwaredirect.com/
Their 'Dataworx Professional' may be what you want.
An output is a PLC's way of getting its inputs to change.

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Access Database
« Reply #2 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.

b_carlton

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 606
    • thePLCguy
Re: Access Database
« Reply #3 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.
An output is a PLC's way of getting its inputs to change.

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Access Database
« Reply #4 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?

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Access Database
« Reply #5 on: October 10, 2013, 03:34:52 PM »
Are you pulling in the entire database?
Is it just a .csv file?
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Access Database
« Reply #6 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.

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Access Database
« Reply #7 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.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Access Database
« Reply #8 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. ???

plcnut

  • Hero Member
  • *****
  • Posts: 814
    • premiersi.com
Re: Access Database
« Reply #9 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.
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

ATU

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 2126
  • YKPAIHA
    • ATU, Inc.
Re: Access Database
« Reply #10 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.

deep6ixed

  • Hero Member
  • *****
  • Posts: 105
Re: Access Database
« Reply #11 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.

CReese

  • Hero Member
  • *****
  • Posts: 184
Re: Access Database
« Reply #12 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.