ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 01-18-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default 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  
Old 01-19-2011
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

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  
Old 01-19-2011
AJ Bobo's Avatar
AJ Bobo AJ Bobo is offline
Flexsim Senior Developer
 
Join Date: Jul 2007
Posts: 108
Downloads: 8
Uploads: 0
Thanks: 23
Thanked 89 Times in 41 Posts
Rep Power: 221
AJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the roughAJ Bobo is a jewel in the rough
Default

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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.