Andreschrosa Posted October 21, 2008 Share Posted October 21, 2008 When trying to open ODBC database from scripting, I run in the following error: O1002 Unable to open ODBC database: lookup Line 14 - Uncaught error in sequence lookup global string DSN global string user global string passw private handle private result DSN = 'DSLeituras' user = 'root' passw = '' handle = db.open(DSN, user, passw) ///this is line 14/// anything wrong with this declaration? Link to comment Share on other sites More sharing options...
AzeoTech Posted October 21, 2008 Share Posted October 21, 2008 Possibly. First, did you create an ODBC data source for your database, or is DSLeituras the actual name of the database? DAQFactory does not connect directly to databases, but rather uses ODBC as a linkage. You therefore have to create an ODBC data source. The user / password combination is usually for the ODBC linkage and not the database itself. You usually specify the database user/password when setting up the ODBC. Link to comment Share on other sites More sharing options...
Andreschrosa Posted October 21, 2008 Author Share Posted October 21, 2008 Yes, I did crate the datasource using mysql. I'm running windows vista 32 bits by the way. Tried using: handle = db.OpenEx("DSN ='DSLeituras'; UID ='root';PWD=;DATABASE ='leituras'") then it returns the following error: O1002 Unable to open ODBC database: lookup Line 14 - Uncaught error in sequence lookup Link to comment Share on other sites More sharing options...
AzeoTech Posted October 21, 2008 Share Posted October 21, 2008 You can't create the datasource in mySql. DataSources are an ODBC thing which is a windows thing, not a mysql thing. You will need to get the MySQL ODBC connector which is available from their website, install it, then create a datasource with it from windows ODBC settings (under administrator settings / ODBC). It is described in our help in general terms in the logging chapter. Link to comment Share on other sites More sharing options...
Andreschrosa Posted October 21, 2008 Author Share Posted October 21, 2008 I did it, created the datasource in ODBC administrator in windows. I meant mysql as the base for the datasource. Somehow it dosent seen to work. However, I can log data to this datasource using the logging component from DAQFactory. Link to comment Share on other sites More sharing options...
AzeoTech Posted October 21, 2008 Share Posted October 21, 2008 OK, in the logging set you are presumably not specifying a user name, right? So try opening it without using a user name. If that doesn't work, try creating a blank document and then open it from there. Its possible that the logging set is interfering with the db.open command. Link to comment Share on other sites More sharing options...
Andreschrosa Posted October 21, 2008 Author Share Posted October 21, 2008 No good yet... tried opening a new document in DAQFactory and pasting the code there, it still dosent work. I'm guessing it could have something to do with regional settings or somesuch, tried using "" and '' for the strings, but still no good. Are those parameters from DAQFactory? DSN, UID, PWD, DATABASE? Or those should be particular to the mysql sql script? global handle handle = DB.OpenEx('DSN=dsleituras;UID=;PWD=;DATABASE=leituras') Link to comment Share on other sites More sharing options...
AzeoTech Posted October 21, 2008 Share Posted October 21, 2008 When you use OpenEx(), the string you specify is passed directly to ODBC, so the parameters are ODBC not DAQFactory. This is to allow complete control over the open string. I believe in the logging set (which uses a different technique to open databases than the db.openex() function) it opens with the string: "DSN=mydsn; ODBC;" where mydsn is the datasource string you specified in the logging set. Perhaps you just need the ODBC; at the end? Link to comment Share on other sites More sharing options...
Andreschrosa Posted October 21, 2008 Author Share Posted October 21, 2008 Not working yet. Should I do anything like lock our unlock some port to get acess to the datasource? Link to comment Share on other sites More sharing options...
AzeoTech Posted October 22, 2008 Share Posted October 22, 2008 Hmm, it shouldn't be this difficult. Maybe you have something mis-set in your ODBC settings. Can you post some screenshots of the ODBC settings? Link to comment Share on other sites More sharing options...
Andreschrosa Posted October 22, 2008 Author Share Posted October 22, 2008 Sure, but as I said, this works with logging set. After some searching on mysql developer network, I found some parameter to connect to the datasource, however, this also dosent work. handle = DB.OpenEx("DSN='SLeituras'ODBC;DRIVER='{MySQL ODBC 5.1 Driver}';SERVER='localhost';DATABASE='leituras';UID='';PWD='';OPTION='3'") screenshot of the ODBC configuration: Link to comment Share on other sites More sharing options...
AzeoTech Posted October 22, 2008 Share Posted October 22, 2008 Note you have two typos in that last script, the DSN is wrong and you forgot the ; before ODBC. Try these: 1) Open using Open() instead of OpenEx(). Unless you specified a user/password in the details of ODBC (not the "root" you specified), you should pass "" for user and password. 2) User this string: handle = DB.OpenEx("DSN='DSLeituras'; UID=''; PWD=''; ODBC;) Much of that extra stuff you specified in that last post does nothing because its in the ODBC driver. Link to comment Share on other sites More sharing options...
Andreschrosa Posted October 23, 2008 Author Share Posted October 23, 2008 Still cant open it, should I call anything else before calling the db.open command? Maybe it's a issue with mysql and windows vista, maybe I should switch to another sql server and give it a try. Link to comment Share on other sites More sharing options...
AzeoTech Posted October 23, 2008 Share Posted October 23, 2008 I just noticed that I forgot a closing " handle = DB.OpenEx("DSN='DSLeituras'; UID=''; PWD=''; ODBC;") Link to comment Share on other sites More sharing options...
shimh Posted March 1, 2009 Share Posted March 1, 2009 I have the exact problem right now. db is working if using logging. But I cannot open it via script. The error is either cannot open or unknown error. I actually have tried all what you have tried before finding this post. I would like to ask how the issue is solved? database name: ewsdb odbc connector name: ews_data odbc driver: mysql odbc 5.1 driver Thanks. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 2, 2009 Share Posted March 2, 2009 Not sure. It was, I believe, a syntax error, but Andreschrosa never replied saying it worked. Note that in this line: handle = DB.OpenEx("DSN='DSLeituras'; UID=''; PWD=''; ODBC;") the '' after UID and PWD are two single quotes ' and ', not a single double quote " For you, the database name and type don't matter. Only the data source name: ews_data I believe someone else had a problem where they created a datasource as a system DSN but it needed to be a user DSN. Its a recent post if I remember, probably under logging. Link to comment Share on other sites More sharing options...
shimh Posted March 3, 2009 Share Posted March 3, 2009 I believe that it is kinda like a bug in daqfactory. The following is what I have now: Using MySQL ODBC Connector 3.51: db.Open("ews_data") : Working Logging method: Working Using MySQL ODBC Connector 5.1: db.Open("ews_data"): O1003 Unknown error accessing ODBC database Logging method: Working So please verify which and what is wrong. It is definitely not some grammar issue at the user's side. Link to comment Share on other sites More sharing options...
AzeoTech Posted March 8, 2009 Share Posted March 8, 2009 Nope, not a bug. DAQFactory simply calls the Windows API for ODBC, and certainly the fact it works in the logging set means DAQFactory is fine. The issue is your connection string. Obviously there is some difference in it that is making it not work. I believe the logging set adds "ODBC;" to the end of the connection string, so maybe that is it. Link to comment Share on other sites More sharing options...
sreedevib Posted October 5, 2009 Share Posted October 5, 2009 Hi, I am also facing same problem. I can open the ODBC database in logging & exporting. But, when I try to open it from sequence using both db.open and db.openEx methods, I am getting "O1002 Unable to open ODBC database: s1 Line 5 - Uncaught error in sequence s1" Please let me know how to resolve this issue? Thank you Link to comment Share on other sites More sharing options...
AzeoTech Posted October 8, 2009 Share Posted October 8, 2009 Please post the db.open() line you are using. There is probably a typo. Link to comment Share on other sites More sharing options...
polilies Posted June 17, 2011 Share Posted June 17, 2011 dbase = db.Open("janitza") this is my connection code to "Mysql Connector 5.1".. It works fine . and i defined user =root and a password for it. this statemnet needs too much experiment i think. i was uninstall the database server and the connector driver to solve that connection problems. But i can say Mysql connector doesn't need "OpenEx" function. you can write user and password on connectors interface.. Link to comment Share on other sites More sharing options...
AzeoTech Posted June 18, 2011 Share Posted June 18, 2011 Yes, you can, but then anyone can connect to that ODBC connection. By requiring the password (not specifying it in the MySQL ODBC Connector, anyone connecting to it must provide a user/password. This adds a level of security. Link to comment Share on other sites More sharing options...
ateori Posted October 14, 2017 Share Posted October 14, 2017 I had this problem too. Did you find the solution? handle = DB.OpenEx("DSN='mysqldb'; UID=''; PWD=''; ODBC;") I get the following error. O1002 Unable to open ODBC database: Startup Line 16 - Uncaught error in sequence Startup Link to comment Share on other sites More sharing options...
AzeoTech Posted October 17, 2017 Share Posted October 17, 2017 I'm not sure. That post was from 6 years ago. If you don't need a user / password, I would just use db.open(). If that doesn't work, there are several possibilities, but the most likely one is: DAQFactory is a 32 bit application, so you have create your ODBC data sources in the 32 bit version of ODBC. On 64 bit versions of windows there are actually two ODBC control panels, one for 32 bit, and one for 64. Unfortunately, only the 64 bit version shows in control panel. Personally, I added a shortcut to the 32 bit version to my control panel. The path on my computer is: C:\Windows\SysWOW64\ODBCCP32.CPL Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.