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
|
||||
|
||||
Specifying ODBC driver for PostgresSQL
Hello,
In attempting to access data stored in a PGSql database we used the following code in a user event. The purpose of this was to test a connection between flexsim and the target database table. dbusername("postgres","password"); dbopen("postgres","select * from testing",1,0); int testvalue=dbgettablenum(1,1); string val =dbgettablestr(1,2); pf(testvalue); pr(); pt(val); pr(); Firstly, we had some trouble configuring the dbopen command as it has four parameters required and not three (as specified in the commands help file, so we just added a ,0 for the final argument). Once we sorted that out we obtained the following error; Data source name not found and no default driver specified postgres Driver: [Microsoft][ODBC Driver Manager] ODBC Code: IM002 Flexsim Code: 2 - SQLConnect I should also mention we have specific ODBC drivers for PGSql installed (called psqlODBC_x64 as we are using a 64 bit machine). Any help would be greatly appreciated. Thanks |
#2
|
||||
|
||||
Did you define a user DSN then? Just installing the ODBC drivers is not enough, you have to create a user DSN and in your case it should be called "postgres" and point to the database.
|
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
Nischith Kashyap (01-19-2011) |
#3
|
||||
|
||||
Your User DSN also needs to be a 32-bit data source. If you're using a 64-bit version of Windows, then the Data Sources shortcut in the Control Panel only allows you to edit 64-bit data sources. You can edit 32-bit data sources by running the following program: C:\Windows\SysWOW64\odbcad32.exe. I made a shortcut to that program in my Start Menu so that I can get to it easily.
|
The Following User Says Thank You to AJ Bobo For This Useful Post: | ||
Nischith Kashyap (01-19-2011) |
Thread | Thread Starter | Forum | Replies | Last Post |
Sketchup driver failure | David Chan | Installation | 7 | 02-07-2011 09:27 AM |
PostgreSQL ODBC connection | kartikjadhav | Q&A | 4 | 12-21-2010 07:23 AM |
ODBC error | Johannes Cottyn | Q&A | 4 | 04-08-2010 09:35 AM |