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 12-20-2010
kartikjadhav kartikjadhav is offline
Flexsim User
 
Join Date: Dec 2010
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kartikjadhav is on a distinguished road
Default PostgreSQL ODBC connection

Hi Folks,

I am using PostgreSQL( for the first time ) as an database ,i have set up an DSN connection .

I am trying to connect to the db by the following code


treenode current = ownerobject(c);
dbusername("postgres","password");
dbopen("kartik","output",0);



---------------------------
ODBC Error
---------------------------
Data source name not found and no default driver specified.

Driver: [Microsoft][ODBC SQL Server Driver]
ODBC Code:IM002
Flexsim Code: 2 - SQL - Connect
---------------------------
OK
---------------------------


Any ideas on how to avoid this error/popup to occur?

Thanks in advance!
  #2  
Old 12-21-2010
michaelsmith michaelsmith is offline
TMN Simulation -Australia
 
Join Date: Aug 2007
Location: Hobart Tasmania
Posts: 62
Downloads: 7
Uploads: 0
Thanks: 31
Thanked 19 Times in 12 Posts
Rep Power: 170
michaelsmith will become famous soon enough
Default

Do you have the correct driver for PostgreSQL to set up your DSN or are you using the SQL Server one?
  #3  
Old 12-21-2010
kartikjadhav kartikjadhav is offline
Flexsim User
 
Join Date: Dec 2010
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kartikjadhav is on a distinguished road
Default

Hi Michael,
yes i have installed the correct driver for postgreSQL , No i am not using the SQL server driver.

I reckon that while using postgreSQL :

(a) dbusername() - we use this to connect to the database ( by giving the username ans password) .

(b) dbopen() - opens the database and accesses the tables

I have created an DSN , Do we require an additional query to access the PostgreSQL server ? ( which in turn uses dbusername and dbopen to access the databases present in the server)

For example : While Using Microsoft Access database

string ODBCname = "AccessFlexsimDB";

Cheers and Regards,
  #4  
Old 12-21-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

In the code above 'kartik' is your DSN. Is that what you have set up?

You put 0 for tablemode, yet entered "output" for the SQL statement, which isn't valid SQL. Is that a tablename?
  #5  
Old 12-21-2010
kartikjadhav kartikjadhav is offline
Flexsim User
 
Join Date: Dec 2010
Posts: 3
Downloads: 0
Uploads: 0
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kartikjadhav is on a distinguished road
Default

Hi Jason,

Yes you are absolutely right,

Kartik = DSN setup
Output = Table name.

Thanks a ton for the quick reply .


Thread Thread Starter Forum Replies Last Post
ODBC error Johannes Cottyn Q&A 4 04-08-2010 09:35 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
how to send msg to another which do not have connection with the sender object KelvinHo Q&A 3 03-05-2008 04:28 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.