Jump to content

DB Read and DB Write Steps Example


gtwirth
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • 9 months later...

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/en-US/1d5c04c7-157f-4955-a14b-41d912d50a64/how-to-fix-error-the-microsoftaceoledb120-provider-is-not-registered-on-the-local-machine


http://www.microsoft.com/en-us/download/details.aspx?id=13255

Link to comment
Share on other sites

  • 3 weeks later...
  • 11 months later...

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.

  • Thanks 1
Link to comment
Share on other sites

×
×
  • Create New...