DB Read and DB Write Steps Example

Do you have objects, models, libraries, path decorators, textures, symbols, custom API code, documentation, or anything else others might find useful? Please attach it here with a brief description.
Post Reply
gtwirth
Simio Team Member
Posts: 156
Joined: Mon Jun 09, 2008 4:42 pm

DB Read and DB Write Steps Example

Post by gtwirth » Wed Dec 19, 2012 4:20 pm

NOTE....Code has been removed from this post. Please use the DB Read and DB Write steps that are provided when Simio is installed. There is a DBReadWrite simbit. The code is provided in C:\Users\Public\Documents\Simio\Examples\UserExtensions\DbReadWrite
Glen Wirth
Simio LLC

gtwirth
Simio Team Member
Posts: 156
Joined: Mon Jun 09, 2008 4:42 pm

Re: DB Read and DB Write Steps Example

Post by gtwirth » Fri Oct 18, 2013 7:27 am

If you want to connect use MS Access, here is the information that you need. (NOTE: Writing to MS Access is not recommended....It is very slow. We suggest using MySQL instead. Instruction on how to setup MySQL are provided in the DBReadWrite simbit.)

The connect string should be: Provider=Microsoft.ACE.OLEDB.12.0;data source=C:\\Users\\dbName.mdb

The provider should be: OleDb Data Provider


If you are getting an error stating"Microsoft.ACE.OLEDB.12.0 provider is not registered on the local machine", see the following URLs... Running connectivity to MS Access using 64 bit apps is a well known issue. If this is an issue on your side, either follow the steps in the following URL or run SImio in 32 bit mode.

http://social.msdn.microsoft.com/Forums ... al-machine

http://www.microsoft.com/en-us/download ... x?id=13255
Glen Wirth
Simio LLC

Achrafchen
Posts: 2
Joined: Sat Jul 13, 2013 7:50 am

Re: DB Read and DB Write Steps Example

Post by Achrafchen » Sat Nov 02, 2013 7:49 am

Hello Glen Wirth,
thank you,
I run the model but it displays this message:
Attachments
Simio.png
Simio.png (132.06 KiB) Viewed 5986 times

sparakh
Posts: 11
Joined: Mon Jan 30, 2012 8:41 am
Contact:

Re: DB Read and DB Write Steps Example

Post by sparakh » Sun Oct 05, 2014 9:48 pm

I ran into a problem with writing data to a MySQL database table from Simio. The issue was MySQL was complaining about the String representation of a node (Node.Name) that I was trying to write to a VARCHAR() type database column using the DBExecute Step (using native sql in the SQL Statement). The error was something on the lines of "Unknown Column in field list". Found the answer on a mySQL posting. The solution is to surround the String value with a single quote (') character when writing it out to using a DBExecute statement. MySQL thinks it reading a column name instead of an actual value (wierd!).

For instance, if I wanted to write the String "ABC" to a VARCHAR column, I should instead write "'ABC'" (adding a single quote on either sides of the String). If I wanted to write the Node name to the VARCHAR column, I should write "'" + Node.Name + "'"

I thought this might be helpful and save others valuable time debugging.
Saurabh Parakh
saurabh@mosimtec.com

Post Reply