ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
Problem with connection of Microsoft SQL server2005
Hello,
I want to use Microsoft SQL server2005 as a database,but i have no idea of steps to connect it. anyone could tell me ? thanks a lot . Ilivid |
#2
|
|||
|
|||
Set up an ODBC Data Source Name (DSN) that points to your SQL database and then give that name in the dbopen() command in Flexsim. That's done in odbcad32.exe which is usually listed under 'Administrative Tools' in the control panel as "Data Sources (ODBC)", or try just entering odbcad32.exe in the search box under Start.
That's the connection, but if you don't know about that there's probably other stuff you need to know too. Post back here and we'll try and cover each point in turn. In particular take a look at the command documentation for the following ODBC commands - dbopen(), dbclose(), dbsqlquery(), dbchangetable(), dbgetmetrics(), dbgetfieldname(), dbgetnumrows(), dbgetnumcols(), dbgettablecell(), dbsettablecell() |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
Ilivid zheng (03-20-2011) |
#3
|
|||
|
|||
I try it.There is a popup windonw as flowing when i run model.
--------------------------- ODBC Error --------------------------- Scheduling SQL server does not exist or Access denied Driver: [Microsoft][ODBC SQL Server Driver][Shared Memory] ODBC Code:08001 Flexsim Code: 2 - SQLConnect --------------------------- OK --------------------------- I write the code in the OnRest trigger as following. dbopen("Scheduling","select * from table_1",1,0); The "Scheduling" is DSN. And set the driver as SQL server as shown by attachament. I just want to try if it can connect to SQL. but failed! Any ideas on how to avoid this error occuring? Thanks in advance! |
#4
|
|||
|
|||
Are you using a 64-bit OS? If so you might want to try the database admin tool found at C:/Windows/SysWoW64/odbcad32.exe rather than using the one in the control panel.
Can you try and connect using ODBC from another application (Excel) too? If that works then we can dig further. |
#6
|
||||
|
||||
I did a little testing and was able to get the 08001 error if the SQLServer service wasn't running. If that's the case, then Flexsim cannot connect to it. Use the SQL Server Connection Manager to make sure that the server is actually running correctly.
Also, I noticed that your dbopen() call uses a SQL statement as the initial command, but you pass a 1 as the third parameter. This will tell Flexsim to work in Table mode, instead of SQL mode. If you want to use SQL queries to interact with the database, then you need to pass a 0 as the third parameter. The command should be: dbopen("MyDatabase","SELECT * from MyTable",0,0); |
The Following User Says Thank You to AJ Bobo For This Useful Post: | ||
Ilivid zheng (03-29-2011) |
#7
|
|||
|
|||
Thanks for your message!
several days I did not online.first i check the sever,it is runnning correctly.and then i try it again. i set a userDSN as "MyDatabase".when i test Database Source,there is Connection failure indication.i thought this is why i cannot connetct to SQL in flexsim. |
#8
|
||||
|
||||
It sounds like the problem is at the DSN level. Once you have configured the DSN so that it connects to the database correctly, Flexsim should be able to connect to the database as well.
|
The Following User Says Thank You to AJ Bobo For This Useful Post: | ||
Ilivid zheng (04-04-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
When I want to delete the connection of 'D' key generattion. | syseo | Container Terminal (CT) Library | 1 | 01-19-2011 08:05 AM |
PostgreSQL ODBC connection | kartikjadhav | Q&A | 4 | 12-21-2010 07:23 AM |
PLC connection, positioning issues | Stephan Seidel | Q&A | 13 | 04-08-2010 01:02 AM |
Batch connection changes | KelvinHo | Q&A | 2 | 02-05-2010 03:01 PM |
Port Connection Problem | Joe Allen | Q&A | 2 | 05-11-2009 10:56 AM |